Deserialize json one record at a time
I am working with large json files and memory is a concern. I would like to read one object into memory at a time from file. Is this possible? In ServiceStack.Text docs it says there is an API usin...
- Modified
- 8 Jan at 14:14
Using Autofac with ASP.Net Core 3.1 generic host "Worker Service" application
In an ASP.Net Core application, its easy to configure Autofac using: But in a generic host, the **Worker class** does not have any built in support for `ConfigureServices` and `ConfigureContainer`. Ho...
- Modified
- 5 May at 15:47
Unable to consolidate NuGet package transitive dependency versions in two NET Standard projects
I have a solution with multiple .NET Standard 2.0 projects. One uses the `Google.Protobuf (3.11.2)` NuGet package, that depends on ``` System.Memory (4.5.3) System.Buffers (4.4.0) System...
- Modified
- 10 Jan at 11:47
ServiceStack's HttpResult class does not properly format CSV files
I am trying to output a CSV file using an endpoint on a service in ServiceStack, using the HttpResult class. The CSV string itself is being constructed via StringWriter and CsvHelper. If the content...
- Modified
- 8 Jan at 02:45
How to avoid violating the DRY principle when you have to have both async and sync versions of code?
I'm working on a project that needs to support both async and sync version of a same logic/method. So for example I need to have: ``` public class Foo { public bool IsIt() { using (var co...
- Modified
- 7 Jan at 23:54
C# worker service vs windows service
What is the big difference between the and the and which is better to use? When can I use a worker service & windows service?
- Modified
- 7 May at 09:27
Blazor get div position / coordinates
I'm creating a popup component and I want this to be movable. I can move it using the top / left style, but for now they are init to `top:0;left:0;` and so the popup appear on the top left corner of t...
- Modified
- 7 Jan at 16:50
Simultaneous IIS .NET web service calls gets wrong user context after returning from a subroutine
Thanks to some extensive logging I added to our IIS/Servicestack/.NET Web API for a different problem I found some very troubling behavior while looking into a reported issue. Keep in mind that when ...
- Modified
- 7 Jan at 20:37
Change visibility of nav item in blazor menu
I'm using Blazor with .NET Core 3.0. I want to show a login in my menu, when the user isn't logged in yet. When he is logged in, then the login nav item should be hidden. How can I do this? EDIT: I c...
- Modified
- 8 Jan at 07:33
Is there any difference in behaviour between auth/credentials and auth/basic?
We have two separate websites which essentially share the same UserAuth data store. We want to provide the user with a link from one to the other without requiring them to login again. At the moment ...
- Modified
- 7 Jan at 11:22
Entity Framework Core 3.1 Return value (int) from stored procedure
this returns -1, how can i get the actual return value from stored procedure? here is my stored procedure ``` ALTER PROCEDURE [Production].[Select_TicketQuantity] @Ticket NVARCHAR(25), @Refe...
- Modified
- 7 Jan at 08:30
How can I make my app send out notifications when it's loaded but not running in the foreground?
I have an app that I use sometimes. I must have left it there in the background before I slept. When I woke up I saw this notification on my screen. [](https://i.stack.imgur.com/MIIVh.jpg) Does an...
- Modified
- 13 Jan at 22:1
How do I execute a raw SQL query to a custom object in Entity Framework Core 3.1, without migrations wanting to create a table?
I'm querying a `Store` table to show the user the 10 closest `Store`s. I'd like to display the `Name` and `Distance` of the `Store`, but prefer to keep distance in a custom entity. `Store` fields: `I...
- Modified
- 12 Jan at 18:54
HttpRequest.RouteValues property is not accessible from code but accessible from debugger
I am trying to create middleware which performs some checking for particular requests. For example, I have such routes: - `api/Test/{paramToCheck}/aaa`- `api/Test/bbb/ccc` and I have these requests...
- Modified
- 6 Jan at 12:41
.NET Core 3.1 - Could not load file or assembly System.Runtime, Version=4.2.2.0
.NET Core 3.1 console app generates error during build - > System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5...
- Modified
- 6 Jan at 11:41
How should I register my mongodb service that uses the MongoClient, Singleton or scoped?
I am building an API with ASP.NET core using Mongodb and i have different services user service home service and etc. I would like to know should i register every service as singleton as it is mention...
How do I fix the error "Could not load file or assembly 'System.Text.Json, ..."?
- - `PowerShellStandard.Library``System.Text.Json` My `csproj` file contains this block: ``` <ItemGroup> <PackageReference Include="PowerShellStandard.Library" Version="5.1.1" /> <PackageRef...
- Modified
- 4 Jan at 23:19
Streaming videos with ASP.NET Core 3
I'm currently building a API in ASP.NET Core 3 as my first project with .NET Core. I'm currently trying to send a video to my React.js frontend to watch it in the browser. Uploading files and videos...
- Modified
- 4 Jan at 17:49
How can I map enum properties to int in ServiceStack.OrmLite without using annotations?
I want to serialize class from third party library. So I can't use annotations. How to configure ORMLite to serialize all (or specified) enums as int ? Edit: I found a solution. I register a converte...
- Modified
- 4 Jan at 16:31
ASP.NET Core 3 mock authorization during integration testing
I am using ASP.NET core to build an API, and I am trying to upgrade from .NET core 2.2 to .NET core 3.1. I am using the `[Authorize]` attribute to secure the API endpoints and I want to bypass it dur...
- Modified
- 3 Jan at 11:6
System Text JsonSerializer Deserialization of TimeSpan
In researching how to deserialize a `TimeSpan` using Newtonsoft's JSON.net I came across code in my current project that did not use Json.net. It used `System.Text.Json.JsonSerializer` and to not fai...
- Modified
- 2 Jan at 01:20
DefaultIfEmpty Exception "bug or limitation" with EF Core
I tried to execute the following code: ``` await _dbContext.Customers.Select(x => x.CustomerNr).DefaultIfEmpty(0).MaxAsync() + 1; ``` Essentially it has to get the highest customer number from the ...
- Modified
- 2 Jan at 05:54
What is the difference between File(), PhysicalFile(), PhysicalFileResult() in ASP.NET Core?
I am trying to build a Web API endpoint using ASP.NET core 3.1 what would allow an application to send me an id, and the response would be with the corresponding file. Here is my method ``` [HttpGet...
- Modified
- 31 Dec at 16:0
Blazor Project structure / best practices
My company is moving from a legacy codebase to a more modern platform and we are moving to Blazor. We are currently just getting involved with ORM's and best practices and there seems to be a lot of c...
- Modified
- 31 Dec at 02:18
How to use IFormFile as property when uploading file to a server using Asp.NET Core 3.1 framework?
I am trying to create a Web API that would handle storing files. Asp.Net core 1.0+ framework ships with [IFormFile](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iformfile?v...
- Modified
- 30 Dec at 23:52