Questions tagged [.net-core]

.NET Core is a lean, composable and cross-platform framework for building web and cloud applications. It is fully open source and available on GitHub (https://github.com/dotnet/core). Applications in .NET Core can be run and/or hosted on Linux and MacOS under .NET Core.

Filter by
Sorted by
Tagged with
2 votes
3 answers
161 views

Polling Application Misses 1/500 records from an OData Feed

I apologize in advance for the lack of knowledge. Please feel free to edit this question to use the appropriate terminology if it is not correct. I recently wrote a .NET core application that is ...
javery's user avatar
  • 61
4 votes
2 answers
188 views

Is the entire web request the right scope for a DbContext in EF Core?

The usual advice for using EF Core in a web application is to use a scoped DbContext per HTTP request. This is even the suggested default for web application in the Microsoft documentation. I recently ...
Mad Scientist's user avatar
0 votes
0 answers
36 views

Azure Service Bus: consume messages from multiple subscriptions vs forwarding messages to a single input queue

I'm designing an Azure Service Bus topology with multiple topics. Each topic is associated with a single message type: this is possible since we have a limited number of message types, each one with a ...
Enrico Massone's user avatar
-1 votes
3 answers
125 views

Possible Solutions for avoiding applications sharing database

Background: I work on a small group (5-10) of lightly used .Net web applications. The applications typically have dedicated databases, but there are instances of an application accessing another ...
jessiebot's user avatar
0 votes
1 answer
83 views

Where to put the reference to Application Insights in an application designed with the Clean Architecture template?

We are implementing an application by trying to follow the Clean Architecture template for C#. Our application is an ASP.NET core web api and we want to implement the observability for that ...
Enrico Massone's user avatar
0 votes
1 answer
158 views

How to organize "master" data VS "working" data in MS SQL

I have this survey software that I'm writing and I'm wondering what would be the best design for my requirement. I'm going to simplify it as best as I can. I have these entities: class Survey { ...
Francis Ducharme's user avatar
5 votes
3 answers
2k views

In .net 6 dependency injection and Program.cs, what is the best practice for handling a large number of dependencies?

I've seen a ton of examples of how to do DI, and the example always shows two dependencies. But what about when you have 50 or 100 dependencies (or more) in a large-ish application? The Program.cs ...
NovaDev's user avatar
  • 159
2 votes
3 answers
353 views

C# Duplicated usage of an if/else condition and a ternary operator. A good practice?

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
0 votes
1 answer
75 views

Good approach to design Business interface for versioned API?

I am designing an API using .NET core 6 C# which has 2 versions. For v1 I have something like the following for the business logic interface (fictional names and simple fields just to facilitate ...
the-4th's user avatar
  • 101
1 vote
0 answers
215 views

What design pattern does this implementation follow?

For a middleware solution I expose an API, which processes data and sends the necessary information to different parties. In the current design we create a new client, which acts sort of like an ...
M. Mayhem's user avatar
-3 votes
3 answers
431 views

Can be logic around `List<T>.Enumerator._version` considered control flow exploitation?

List<T>.Enumerator “snapshots” list version upon creation by _version = list._version;. This allows enumerator to halt enumeration when List<T> changed during it. This behavior likely ...
Yarl's user avatar
  • 288
1 vote
0 answers
254 views

Microservice code reuse strategy for static classes

Hope this is the right place to post an opinion-based question like this. I'm in the process of converting an aging API monolith to a set of .NET 5/C#-based microservices and working on the code reuse ...
JTennessen's user avatar
0 votes
0 answers
44 views

Synchronisation of db state in blazor

I have an app where certain data is stored in the database. Multiple users access the same set of data (similar of a collaboration tool). However, they can non deterministically work on stale data. ...
Mayur Ekbote's user avatar
0 votes
1 answer
255 views

DDD+CQRS - Should I always check if the Databases are online?

I'm developing an intranet application and I'm trying to use some concepts from Domain Driven Design (DDD) and Command and Query Responsibility Segregation (CQRS) in .NET Core, with EFCore. But, to ...
Rick Wolff's user avatar
0 votes
1 answer
80 views

Finding/determining future data for pricing

I'm honestly not even sure how to go about how to ask what I'm looking for/need. lol. I'm currently using Sql Server for my database and the 'new' .net 5. There are multiple pricing tables that each ...
Travis's user avatar
  • 19
0 votes
1 answer
241 views

Processing large number of messages in a thread-safe manner

I have the following use case and would like to implement it in a thread-safe manner. Think of a Stack Overflow-like web application. Somebody upvotes a question. A new event is sent to the message ...
robotron's user avatar
  • 767
2 votes
1 answer
640 views

Dependency injection post-serialization

I'm modeling a general RPG-game-style quest system where player choices lead to certain effects. The below examples have been simplified for the sake of clarity. This is a web-based context, which I ...
Flater's user avatar
  • 49.9k
0 votes
2 answers
521 views

How to implement authorization in a microservices architecture?

I'm looking for a way to avoid centralized management of authorization rules. I'd like every microservice to be responsible for the authorization logic of its actions, but I'm having some trouble ...
Gur Galler's user avatar
9 votes
2 answers
10k views

Should appsettings.Development.json be added to the repository?

Lately I got in a discussion with my colleague whether the appsettings.Development.json should be added to the git repository or not. My considerations are: when a developer clones a repository to his ...
Frits's user avatar
  • 410
-1 votes
1 answer
37 views

Are good practice to use SKPointI as key for dictionary

In my application I using SKPoinI as a key to store some small objects in Dictionary. SkiaSharp already used in this project for drawing and not need to be referred to only to allow SKPointI to be ...
Bogdan Samchuk's user avatar
1 vote
1 answer
207 views

How can I write integration tests if I need dynamically generated values from a javscript file?

We have a react website that, as part of it's process, loads a dynamically generated javascript file from a third party. It uses some of the scripts in this javascript file to generate values, which ...
David Jacobsen's user avatar
1 vote
0 answers
95 views

How can I improve this API solution

Intro I'm creating an app and I'm not sure if the structure of the solution is correct. I have a BaseController that uses generics. This controller is inherited by others that do not have to ...
Emily's user avatar
  • 19
1 vote
2 answers
1k views

Why it is possible to specify a value comparer for ImmutableDictionary<TKey, TValue>?

What is the intended usage of the ImmutableDictionary<TKey,TValue>.ValueComparer property? Why is it useful being able to compare dictionary values by using a specified equality semantic? I ...
Enrico Massone's user avatar
1 vote
1 answer
386 views

Custom File System Index/Cache - How to save index

I've got an extremely oniony(deep) folder structure which contains Appx 1,000,000 text-based files on a network share. Using windows search is extremely slow and unreliable. I've created some text ...
GisMofx's user avatar
  • 379
5 votes
4 answers
494 views

How to create a modular system of multiple .NET Core applications extending a single application?

So first of all let me explain what I want to achieve: I want to create a basic .NET Core console application which is responsible for loading external extensions (more on this later on), listening ...
Olaf Svenson's user avatar
0 votes
1 answer
215 views

Is it bad practice to mutate your HttpClient objects?

Im in the process of creating a base class for typed HttpClient services (yes, I'm utilizing IHttpClientFactory). I wrote the process in such a way that for each CRUD method invoked from the service, ...
8protons's user avatar
  • 1,369
2 votes
3 answers
2k views

Why is it allowed to refer .net framework libraries in a .net standard library?

.Net Standard is specification. There are two popular implementation of the .net standard specification. ie .Net Core & .Net Framework When I create .Net Standard library, I am allowed to refer ...
Nachiappan Kumarappan's user avatar
-1 votes
2 answers
598 views

How to Mock NamedPipeClientStream

I created a class called MpvController to handle communication protocols over a .NET NamedPipeClientStream. Now, I need to test this controller. I have a second class named MpvControllerFactory that ...
Etienne Charland's user avatar
0 votes
5 answers
314 views

How to force consumption of an object once it is created?

Use case: I need to create serial numbers that are accountable for, so serial number objects, once created must have a destination: either they are used (they get a code) or they are discarded. For ...
Hefaistos68's user avatar
2 votes
2 answers
1k views

C#: Use Double Await Cause Issues?

We have Application service Method, which extracts data from SQL database using Entity Framework Core . Its Async method along with the Async Controller. Service: public async Task<IEnumerable<...
user avatar
0 votes
3 answers
1k views

When to set constants during DI setup and when expect them on the fly as parameters?

Let's assume you have a project (e.g. .NET Core) using dependency injection. A database repository relies on a database connection string. public abstract class BaseRepository { // use this when ...
Question3r's user avatar
1 vote
4 answers
2k views

Should you validate route parameters or let them fail with a 404?

So this is an example endpoint to fetch one user by its username [HttpGet("{username}")] public async Task<ActionResult<object>> GetUser([FromRoute] string username) { // ... ...
Question3r's user avatar
0 votes
0 answers
490 views

Net Core: Solutions to Update History Tables in Application Design

Our company did not properly design Address Record Code Module. Developers are updating Address SQL table with Multiple Service Methods, and are not updating AddressHistory Sql table. They're asking ...
user avatar
1 vote
1 answer
384 views

keep Controllers at one place or organize by domain

When creating a new .NET Core Web API the controllers will be put in the Controllers directory. I want to create request models for incoming requests (for validation purposes) and response models ...
Question3r's user avatar
2 votes
3 answers
464 views

How to clone an object graph and keep relationships of objects intact?

In my ASP.net core application with Angular 2+ client, I work with a complicated object graph. In the object graph I have some objects with references to each other. I have a simplification included ...
Superman.Lopez's user avatar
0 votes
1 answer
577 views

What's a good liveness probe for a Hangfire background job server?

We're in the process of moving everything to K8s and one of our applications is a small .NET Core 2.2 console app that runs a Hangfire background job server. At the moment the app runs as a Windows ...
Xzenon's user avatar
  • 187
3 votes
0 answers
110 views

Technical architecture of platform on .Net Core

I'm designing a platform that will run robots developed by others. Basically anyone could implement a IAutonomousAgent and register the implementation on the platform. At runtime, the platform will ...
Leonardo's user avatar
  • 364
0 votes
2 answers
2k views

Call API endpoint from API itself

I'm creating an .NET Core 3 API with Entity Framework. The data is from an existing database. Now I've the following situation: /persons -- get all the persons /companies -- get all the companies /...
Bjorn's user avatar
  • 67
1 vote
2 answers
749 views

Is there still a place for non-async methods in Data Repository?

If we start a .NET Core 3.0 project today, which will use database connection (for example ASP.NET Core Web API), is there still a place for non-async operations while talking to the database? Or in ...
Adam Wojnar's user avatar
0 votes
0 answers
334 views

Registering dependency implemented in separate assembly with shared interfaces

Situation: I have a project with a Business Layer (WizBang.BL) that contains nearly all of my application logic. It communicates with a Data Layer (WizBang.Data) that contains by entity classes and ...
Valuator's user avatar
  • 101
18 votes
3 answers
32k views

How to justify using await instead of .Result() or .Wait() in .NET Core?

Since the inception of .NET Core, console apps, function apps, ASP.NET etc. are not using synchronization context in async methods (so they're synchronizing straight to Thread Pool). This means that ...
kor_'s user avatar
  • 289
-1 votes
1 answer
201 views

Dependency Injection and Factory resolution

In the below example, assume FooA and FooB each have constructors that have a large amount of dependencies being injected into them. If I have a class that needs to determine which IFoo ...
gilliduck's user avatar
  • 237
1 vote
2 answers
799 views

Unit Testing Complicated Service Call with Many Methods

I am trying to understand principle of Unit testing, Purpose, and Moq. We have complicated Service Call. The Service Call encompasses numerous Repositories and Services, with dependencies and ...
GregDavis's user avatar
0 votes
1 answer
1k views

Should Specification Patterns return IEnumerable, IQueryable, or Expression?

We are implementing Specification Patterns with Domain Driven Design. Company architect also wants us to utilize Generic repository (not my choice). Currently require specification Pattern for Filter ...
Matt Smith's user avatar
1 vote
1 answer
2k views

Domain Driven Design: Should Specification Pattern exist in Repository or Application level for Paging?

In Domain Driven Design, should the specification pattern for paging/pagination exist on the Repository level or Application level, or another layer? Trying to see what Eric Evans author of DDD stated....
Matt Smith's user avatar
1 vote
1 answer
117 views

How to properly handle deployment configuration for Xamarin Forms app

We are currently working on a Xamarin Forms (.NET Core) application. We use Microsofts DevOps for the code repo, building and deployment. Since we want to test newly developed features in a safe ...
Manuel Merzinger's user avatar
6 votes
3 answers
4k views

Why is it necessary for every new api to be async?

I'm expressing my frustration here somewhat, but why do many new libraries only have asynchronous APIs? For example I'm creating a small utility to fetch a web page and parse some data from it. ...
spirc's user avatar
  • 280
0 votes
0 answers
73 views

How to send messages in the order they were queued, while ensuring that client B does not have to wait until client A has received his message?

I have a simplified producer/consumer pattern implemented below. The code outputs: "A" 1 second delay "B" 1 second delay "A" 1 second delay "B" ... What ...
AlanWakeUp's user avatar
-3 votes
3 answers
1k views

Hosting a standalone .Net Core Web Application

We've created a .Net Core Web Application and are deploying it as a stand-alone exe. The main reason for deploying it stand-alone was to not be dependent upon the version of .Net Core installed on the ...
user3167162's user avatar
0 votes
1 answer
83 views

A RESTful API for internal company system accessing peripheral devices

I am currently working on an internal storehouse management system for a certain company. They wanted it to be a web app so that they can use it without installation on any devices. We decided to ...
Valhaal's user avatar
  • 13