Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Posts tagged .net

4 child tags

Use for questions about programming in .NET framework. For .NET Core programming, use [.net-core].

This tag doesn't have a detailed wiki yet.

71%
+3 −0
Q&A Health checks with caching in ASP.NET Core

Context I noticed that an application was flooding the database with simple SELECTs. The investigation revealed some bugs in the health check which theoretically implemented caching (to avoid quer...

1 answer  ·  posted 4mo ago by Alexei‭  ·  edited 4mo ago by Alexei‭

75%
+4 −0
Q&A Dealing with code maintenance when saving a large and complex entity in a single business transaction

Context I am currently working on migrating a legacy application to an ASP.NET Core + Angular application. The Web API's main project is based on Jason Taylor's template (clean architecture) and a...

1 answer  ·  posted 6mo ago by Alexei‭  ·  last activity 6mo ago by r~~‭

50%
+0 −0
Q&A How to define Polly policies when working with Refit library in ASP.NET Core?

Note: this is based on my question on SO and subsequent activity there I am trying to add resilience using Polly to HTTP calls that are performed using Refit library. I am using the Refit factory...

1 answer  ·  posted 8mo ago by Alexei‭  ·  last activity 8mo ago by Alexei‭

50%
+0 −0
Q&A Working with a generic class that uses a type that should be of generic type

I have followed Nick Chapsas' tutorial to avoid throwing a ValidationException to treat validation errors and instead rely on LanguageExt.Common.Result<> from LanguageExt library. I have ma...

0 answers  ·  posted 11mo ago by Alexei‭

Question c# generics .net .net-6
50%
+0 −0
Q&A How to migrate NLog configuration from XML file(s) to application settings (JSON)?

I have just created an ASP.NET Core 6 application and added NLog support for logging: NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger() However, this API is almost deprecated as ...

1 answer  ·  posted 11mo ago by Alexei‭  ·  last activity 11mo ago by Alexei‭

66%
+2 −0
Q&A Order a subcollection from linq

I am using linq/EF core to retrieve data via an API call. How do I sort the collection of related data for each retrieved entity? Assume the following structure: an Order is made on a certain da...

1 answer  ·  posted 1y ago by mcalex‭  ·  last activity 1y ago by Alexei‭

75%
+4 −0
Q&A Measuring the impact of using exceptions instead of return values in an ASP.NET Core application

Context This Q&A from SO suggests that throwing exceptions is incredibly expensive when compared to returning values (return codes): that with return codes instead of exceptions the same pr...

1 answer  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Dirk Herrmann‭

77%
+5 −0
Q&A Mapping generic handler to generic query in MediatR

I am using MediatR in an ASP.NET Core 3.1 application and I want use a generic query and a generic request that deals with getting lists of some standard items I am using in drop-downs and similar:...

0 answers  ·  posted 3y ago by Alexei‭  ·  edited 1y ago by Alexei‭

75%
+4 −0
Q&A What version of runtime environment does a .NET 5 application actually needs?

Our team deals with a legacy application that relies on a rather old deployment process and infrastructure: we deploy the application on an environment very similar to the production called Clon...

0 answers  ·  posted 1y ago by Alexei‭  ·  edited 1y ago by Alexei‭

60%
+1 −0
Q&A Preloading some data at application startup as fast as possible

I am caching some very static information (changes once per day) in my ASP.NET Core application. This is normally done when needed ("lazy"). One such cache item is a 50K list of items that are tak...

1 answer  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Alexei‭

66%
+2 −0
Q&A How to create fire and forget tasks Q&A in ASP.NET Core with dependency injection support?

One of the legacy applications our team manages contained the following pattern (in the controller): // initialization private readonly IServiceScopeFactory _serviceScopeFactory; public FooCon...

1 answer  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Alexei‭

40%
+0 −1
Q&A How to mock LazyCache when performing unit testing?

A few of my services rely on LazyCache and they use it by injecting IAppCache. For unit testing, I would like to mock this. I have found MockCachingService, but it does not do any caching (as spec...

1 answer  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Alexei‭

80%
+6 −0
Q&A Can I set a memory limit for the .NET Core garbage collector to collect objects more aggressively?

I have an ASP.NET Core 5 web application that provides functionality that involves file upload + rather large processing (memory consumption mainly). After each processing (with success or not) the...

2 answers  ·  posted 1y ago by Alexei‭  ·  edited 1y ago by Alexei‭

77%
+5 −0
Q&A How to dynamically change panel of ItemsControl?

Let's say I have some collection of data. My goal is to provide different kind of view of ItemsControl depending on user`s preference. For simplicity, we can assume that user can select only betwe...

1 answer  ·  posted 1y ago by FoggyFinder‭  ·  edited 1y ago by FoggyFinder‭

Question c# .net mvvm avalonia
77%
+5 −0
Q&A Handling high frequency requests with cancellations in an ASP.NET Core application

Issue I have recently discussed with a friend a performance issue he and his colleagues have encountered in an ASP.NET Core 5 application (a checkout app, microservices architecture). The problem...

1 answer  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Derek Elkins‭

80%
+6 −0
Q&A Are there any downsides related to using Maybe or Optional monads instead of nulls?

I have recently stumbled across the Maybe (or Optional) modal usage in .NET Code: example code or this one example article Based on everything I read, there are multiple advantages on relyi...

2 answers  ·  posted 1y ago by Alexei‭  ·  last activity 1y ago by Derek Elkins‭

71%
+3 −0
Q&A How do I redact values when Save()ing a yaml structure with YamlDotNet?

I handle several projects that use yaml files for configuration, and load them with YamlDotNet. It is sometimes useful to log the effective configuration when the program starts, to aid future debu...

0 answers  ·  posted 2y ago by ajv‭  ·  edited 2y ago by Troy‭

Question c# .net yaml yamldotnet
77%
+5 −0
Q&A How to find out which packages target .NET 3.1 in a .NET 5 application?

After upgrading a Web application from ASP.NET Core 3.1 to ASP.NET Core 5.0, it worked fine on an existing server. However, when deployed on a server that had only .NET 5.0 installed, the applicat...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

80%
+6 −0
Q&A How to properly deal with impersonation in a Web application? (security vs. usefulness for tech support)

Context Our team has begun migrating a pretty old internal application and one aspect that got my attention is the impersonation. This is implemented as follows: only administrators are allowed...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by meriton‭

71%
+3 −0
Q&A How to tackle database migrations failure during application initialization on production systems?

Context My ASP.NET Core application got stuck in Production with a 5xx error. By inspecting the logs, I have noticed that a database error occurred during application initialization, namely a SQL ...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by misha130‭

66%
+2 −0
Q&A How do I configure log4net from an arbitrary data structure?

I'm used to working in Python, but my current project is in C#/.NET and uses log4net for logging. Out of the box, log4net uses an XML file for configuration. I dislike XML and want to use something...

1 answer  ·  posted 2y ago by ajv‭  ·  last activity 2y ago by Peter Taylor‭

Question .net log4net
81%
+7 −0
Q&A Update list based on presence of identifier in a second list

In C#, I have two lists and need to mark records in the first based on the second. Here's a sample: public class Vehicle { public string Make { get; set; } public string VIN { get; set;...

3 answers  ·  posted 2y ago by FrankLuke‭  ·  last activity 2y ago by Andrew Shepherd‭

Question c# linq
60%
+1 −0
Q&A What should healthcheck of an Web API application actually check?

I have to add health checks to a rather new application (Web API, not a microservice) and I and a colleague are not agreeing about what other systems I should include in the check. This application...

1 answer  ·  posted 2y ago by Alexei‭  ·  edited 2y ago by Alexei‭

75%
+4 −0
Q&A Declaring interface members with generic return types: "The type parameter [generic type] cannot be used with type arguments"

I'm trying to write an interface to define the set of operations I expect my repositories' Unit of Work implementations to have, and I want this interface to be fulfilled by EF Core's DbContext cla...

2 answers  ·  posted 2y ago by Marc.2377‭  ·  last activity 2y ago by Marc.2377‭

71%
+3 −0
Q&A How to manage views and stored procedures in an ASP.NET Core project?

I am slowly modernizing an older ASP.NET Core Web API and one of the steps involved migrating from database first to code first. Now, all schema changes and seeding is covered by migrations which ...

0 answers  ·  posted 2y ago by Alexei‭

60%
+1 −0
Q&A Are any downsides of hiding the actual Entity Framework Core DbSets and exposing only some generic methods?

I have recently started a project based on the clean architecture principle and noticed that it did not rely on generic repositories since Entity Framework's DbSets are doing the job just fine. In ...

0 answers  ·  posted 2y ago by Alexei‭

66%
+2 −0
Q&A How to perform LEFT JOIN using LINQ method call notation?

I am interested in performing a LEFT JOIN using LINQ-2-SQL when working with method call notation. This answer suggests a way that relies on GroupJoin but it is more verbose than expected: var le...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

72%
+6 −1
Q&A Which abstraction should I choose for background services and why?

Which concept is best for managed background services? 1. RunAsync(CancellationToken): interface IWorker { Task RunAsync(CancellationToken cancellationToken = default); } ... IWorker worker =...

1 answer  ·  posted 2y ago by Kir_Antipov‭  ·  last activity 2y ago by Alexei‭

60%
+1 −0
Q&A Cache data using Redis Cache in an ASP.NET Core 3.1 project

This is an unanswered code review request of mine from Code Review Stack Exchange. Overview I have developed a small ASP.NET Core 3.1 Web API that provides information that is rarely changed (sever...

0 answers  ·  posted 2y ago by Alexei‭

66%
+2 −0
Q&A Measure ASP.NET Core 3.1 Web API action execution times

This is basically an unanswered code review request of mine from CodeReview Stack Exchange. I want to be able to log as accurately as possible, the time spent by a certain Web API action in an ASP....

0 answers  ·  posted 2y ago by Alexei‭

75%
+4 −0
Q&A Implementing impersonation in an ASP.NET Core Web application

I am working at a proof-of-concept for porting an ASP.NET MVC application to an ASP.NET Core API + Angular SPA. One of the features of the existing application is the ability of an admin (typically...

0 answers  ·  posted 2y ago by Alexei‭

66%
+2 −0
Q&A How to perform LINQ joins with multiple fields in a single join?

Note: this is an aggregate of the answer provided for this question. I want to get the LINQ equivalent of the following from SQL: SELECT .. FROM entity1 e1 JOIN entity2 e2 ON e1.field1 = e2.fie...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

Question c# linq join
80%
+6 −0
Q&A Is it recommended for ASP.NET Web API actions to always include a CancellationToken?

Note: This is basically a question from Stack Overflow that was closed for a very long period of time and I fear it might get closed again as primarily opinion based. I am wondering if my ASP.NET C...

1 answer  ·  posted 3y ago by Alexei‭  ·  last activity 2y ago by Peter Taylor‭