How to call one web api controller method into another web api project?
I have two different projects --> Project A and Project B. I want to call controller method of Project A into controller method of project B. For example, Method is a method of which returns stat...
- Modified
- 30 Dec at 14:0
Can a non-nullable reference type in C# 8 be null in runtime?
It seems to me there is really no guarantee that a non-nullable variable won't ever have null. Imagine I have a class that has one property that is not nullable: ``` public class Foo { public Foo...
- Modified
- 9 Apr at 02:2
Is constructor the only way to initialize non-nullable properties in a class in C#?
I have switched to enable nullable in my project that uses C#8. Now I have the following class: ``` public class Request { public string Type { get; set; } public string Username { get; set; ...
- Modified
- 27 Nov at 13:6
How to set consent cookie in Blazor Server
I have a Blazor 3.1 App with Identity where I want to implement a cookie consent banner. In classic ASP .NET Core, there is a nice template for a cookie consent banner. ``` @using Microsoft.AspNetC...
- Modified
- 23 May at 02:55
Using System.Transaction how to update multiple rows in Entity Framework
I want to use `System.Transactions` and update multiple rows. My database is connected using Entity Framework. Below is the code I tried but it throws an error : ``` public void Update(List<Portfo...
- Modified
- 17 May at 09:26
Why do we get possible dereference null reference warning, when null reference does not seem to be possible?
Having read [this question](https://stackoverflow.com/q/59518973/284111) on HNQ, I went on to read about [Nullable Reference Types in C# 8](https://learn.microsoft.com/en-us/dotnet/csharp/nullable-ref...
- Modified
- 10 Apr at 21:36
Square brackets in the controller Route in ASP.NET Core
What do the square brackets in the controller in ASP.NET Core mean? E.g. the here: ``` [ApiController] [Route("[controller]")] public class WeatherForecastController : ControllerBase {...
- Modified
- 29 Dec at 22:5
What is the ?[]? syntax in C#?
While I was studying the which actually an abstract class in [Delegate.cs](https://github.com/dotnet/corert/blob/master/src/System.Private.CoreLib/shared/System/Delegate.cs), I saw the following met...
- Modified
- 30 Dec at 18:41
IApplicationBuilder does not contain a definition for UseIdentity
I'm following an example to configure AspNet Core Identity on Here's the code for StartUp.cs file ``` using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetC...
- Modified
- 30 Dec at 08:39
UserSecrets not working with ModularStartup
I am using 5.7.1 and when I use modular startup UserSecrets are not added to the IConfiguration collection. This works: ``` public static IWebHost BuildWebHost(string[] args) => WebHost.Crea...
- Modified
- 29 Dec at 04:30
Converting Hangfire into modular startup
I am converting my startup code into new [ServiceStack Modular Startup](https://docs.servicestack.net/modular-startup) approach and have hit a snag. I have this code in old startup ``` public void C...
- Modified
- 29 Dec at 03:17
Is using the system.text.json no longer possible for serializing / deserialiing in c#
As described in the official microsoft docs which has been Updated in September of 2019 it says that using `system.text.json` for serializing or deserializing can be done. [https://learn.microsoft.co...
- Modified
- 27 Dec at 16:21
How do I (gracefully) shut down a worker service from within itself?
I'm using the .NET Core 3.1 worker service template to build a Windows Service. I gather that the basic flow should be handled within `ExecuteAsync`, roughly like so: ``` protected override async Ta...
Redis keyspace notifications with StackExchange.Redis For Delete operation
I've been searching to find out how to perform a subscription to key space notifications on Redis using ServiceStack.Redis library for removal of Key. Checking available tests on the git-hub and othe...
- Modified
- 30 Dec at 06:45
Entity Framework Core 3.1 with NetTopologySuite.Geometries.Point: SqlException: The supplied value is not a valid instance of data type geography
I have a model that looks like this: ``` public class Facility { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public NetTopologySuite.Geome...
- Modified
- 20 Jul at 16:44
How to inject or use IConfiguration in Azure Function V3 with Dependency Injection when configuring a service
Normally in a .NET Core project I would create a 'boostrap' class to configure my service along with the DI registration commands. This is usually an extension method of `IServiceCollection` where I c...
- Modified
- 24 Dec at 23:47
How to use 404 routing in Razor Page OnInitialized event
In a server-side Blazor application (Core 3.1) have a Razor that accepts an identifier in the `@page` attribute. If the identifier supplied in the URL corresponds to an existing entity, the page will...
- Modified
- 25 Dec at 20:53
Docker System has not been booted with systemd as init system
I have an Ubuntu 18.04 image runing on my docker container. I login into it and installed `Openresty`. also installed `systemd`. When I use command `systemctl` I get this error: ``` System has not bee...
Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.1.0.0
I am trying to upgrade my API project from .net core 2.2 to .net core 3.1. I get this exception while I try to make the API call. > "Message":"Could not load type 'Microsoft.AspNetCore.Http.Internal...
- Modified
- 24 Dec at 09:8
Servicestack AutoQuery not filtering results
my query /API/Json/GetJson?Desc=test1 I get all records not just the test1 records ``` [Route("/API/Json/GetJson", "GET")] public class GetJson : QueryDb<JsonModel> { public int? Id { get; set; ...
- Modified
- 24 Dec at 19:50
Using Polly for a retry attempt from an async function
I'm trying to retry a failed operation 3 times. I'm using Polly for a retry operation. I want to get the exception in case the retry operation fails and retry again 2 times and so on. ``` return await...
- Modified
- 16 Apr at 13:19
How to Rename Files and Folder in .rar .7z, .tar, .zip using C#
I have a compressed file .rar .7z, .tar and .zip and I want to rename physical file name available in above compressed archived using C#. I have tried this using a sharpcompress library but I can't f...
How can I parse JSON with comments using System.Text.Json?
I have some JSON that includes comments (even though comments aren't strictly allowed in the [JSON spec](https://www.json.org/json-en.html).) How can I parse this JSON using `System.Text.Json`? The ...
- Modified
- 22 Dec at 22:18
Select Control Set Initial Value
We know that with `InputSelect` we cannot use both @bind-value and @onchange... But if we use the latter (with `select` instead `InputSelect`), how can we set a initial value different from the fir...
Create empty IAsyncEnumerable
I have an interface which is written like this: ``` public interface IItemRetriever { public IAsyncEnumerable<string> GetItemsAsync(); } ``` I want to write an empty implementation that returns...
- Modified
- 23 Dec at 06:20