What is the equivalent of Newtonsoft.Json's JsonProperty attribute in System.Text.Json?
What is the equivalent of Newtonsoft.Json's `JsonProperty` attribute in System.Text.Json? Example: ``` using Newtonsoft.Json; public class Example { [JsonProperty("test2")] public string Test...
- Modified
- 4 Jan at 06:26
Why does `UseAuthentication` have to be placed after `UseRouting` and not before?
According to the [documentation](https://learn.microsoft.com/aspnet/core/fundamentals/middleware/?view=aspnetcore-3.0#order), the order of middleware should be like this: ``` app.UseStaticFiles(); ap...
- Modified
- 17 Oct at 13:7
How Async streams compares to reactive extension?
How to compare the following two? Is Rx more powerful? ``` var observable = Observable.Create<char>(async (observer, cancel) => { while (true) { string line = await sr.ReadLineAsync...
- Modified
- 22 Oct at 16:37
How to use .NET reflection to check for nullable reference type
C# 8.0 introduces nullable reference types. Here's a simple class with a nullable property: ``` public class Foo { public String? Bar { get; set; } } ``` Is there a way to check a class propert...
- Modified
- 30 Oct at 09:25
How to ensure our business-service is using the same db connection as the servicestack-service
We do have a few business services, which require an IDBConnection. It's quite important that these services do use the same dbconnection as the 'normal' Service-Stack service, so we do have atomic tr...
- Modified
- 18 Oct at 12:31
Does the new `System.Text.Json` have a required property attribute?
I've combed through the [MS docs](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization?view=netcore-3.0) but cannot find an attribute equivalent to the [NewtonSoft JsonPropertyR...
- Modified
- 12 Jan at 02:54
Enum type no longer working in .Net core 3.0 FromBody request object
I have recently upgraded my web api from .Net core 2.2 to .Net core 3.0 and noticed that my requests are getting an error now when I pass an enum in a post to my endpoint. For example: I have the fol...
- Modified
- 16 Jun at 14:53
ServiceStack logging request body under load issue?
Switched on request logging of body and in development it works fine. Testing now under load and getting error in my log4net logs. ``` ERROR 17-10-2019 14:34:44 ServiceStack.ServiceStackHost [50] - ...
- Modified
- 17 Oct at 14:48
How to specify the assembly version for a .NET Core project?
I noticed in new .NET Core projects there is no `AssemblyInfo.cs` file created. I have seen that you can still set assembly attributes such as `AssemblyVersion` and so forth. Are there still any val...
What are the difference using app.Run and app.UseEndpoints in ASP.NET Core?
I'm using ASP.NET Core and am trying to work out the difference between `app.Run()` and `app.UseEndpoints()`. Are there some advantages / disadvantages of them? I tried to use `app.Run()` in 3.0 but I...
- Modified
- 5 Jul at 02:56
Publishing a standalone exe file with .Net Core 3.0 and using an app.config
I have a .Net Core 3.0 project and wanted to take advantage of the new option to publish the project as a single .exe file. I use the command `dotnet publish -r win-x64 -c Release /p:PublishSingleFil...
- Modified
- 17 Oct at 11:10
Cannot get original executable path for .NET Core 3.0 single file '/p:PublishSingleFile=true'
I published a .NET Core console app with '/p:PublishSingleFile=true' option, but now assembly path is the temporary path where it inflated to. now returns: originally: How can I get the original path ...
HttpClient and socket exhaustion - clarification?
[This article](https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/) says that we should use a static `HttpClient` in order to reuse sockets. But the first comment there says that there i...
- Modified
- 26 Jan at 11:31
Why don't I get a warning about possible dereference of a null in C# 8 with a class member of a struct?
In a C# 8 project with [nullable reference types](https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references) enabled, I have the following code which I think should give me a warning about a...
- Modified
- 10 Apr at 21:44
How to Pass View Data to Partial View in Asp.net core?
I am to new .NET core using 2.2 version. I am trying to pass data to partial view with following code : ``` <partial name="_Emplyees" model="@Model.Employees" view-data="@new ViewDataDictionary(ViewD...
- Modified
- 16 Oct at 18:5
Error :StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete
My unit tests disappear from TestExplorer of visual Studio 2019 16.3.5 The output from test engine is: ``` [16/10/2019 6:45:48.705 Error] StreamJsonRpc.ConnectionLostException: The JSON-RPC connect...
- Modified
- 14 Jan at 13:44
How to make an OwnsOne property in EF Core 3.0 required when mapping to SQL Server columns?
I have a main entity Profile that has a property Name that is a value object. The Name object has two properties First and Last. When I use the Fluent API to map the Name objects properties to columns...
- Modified
- 16 Oct at 15:55
IMemoryCache, refresh cache before eviction
I am trying to migrate my .Net framework application to .Net Core and in this process, I want to move my in-memory caching from `System.Runtime.Caching/MemoryCache` to `Microsoft.Extensions.Caching.Me...
- Modified
- 16 Oct at 06:4
Servicestack ORMLite - Using XML fields in PostgreSQL
I have a web application that is being expanded to include PostgreSQL as a database option. For the existing MSSQL implementation, we use an XML column to save an ad-hoc object as part of our POCO cla...
- Modified
- 15 Oct at 21:23
Can't access automapper context items after upgrade to 9
I have a mapper like this: This gives me an exception saying `You must use a Map overload that takes Action`. Well, I do use the `Map` overload that takes this action. How else can I do this?
- Modified
- 5 May at 13:36
How to resolve HostedService in Controller
I am trying to add a Background Timer in ASP.NET Core 3.0, which periodically executes a task. Google led me to [this](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?v...
- Modified
- 15 Oct at 15:10
How to set json serializer settings in asp.net core 3?
json serializer settings for legacy asp.net core applications were set by adding `AddMvc().AddJsonOptions()`, but I don't use `AddMvc()` in `asp.net core 3`. So how can I set global json serialization...
- Modified
- 15 Oct at 10:21
SignIn for Blazor Server-Side app not working
I am building a sample login razor component for an Asp.net core 3.0 Blazor Server-Side app. Whenever the code reaches the SignInAsyc method it just appears to hang or lock-up, as the code ceases furt...
- Modified
- 15 Oct at 06:10
SyntaxError: Cannot use import statement outside a module
I've got an project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is: ``` require('dotenv').config() import {startServer} fro...
- Modified
- 10 Sep at 05:1
ByteArray to IFormFile
I am developing some REST API with C# and Net Core I have a function in my repository which accepts a parameter of type `IFormFile`. ``` public async Task<bool> UploadFile(IFormFile file) { // ...
- Modified
- 14 Oct at 14:31