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.
93 questions
4
votes
4
answers
283
views
Is it okay to deploy both front end and backend everytime if they are in a single repository
I have a project with .net core web api backend and angular as front end.
I have single repository for both the projects with front end and backend in their own separate folders.
I have written ...
3
votes
1
answer
292
views
Gradual upgrade of an inherited .NET Framework project
I'm seeking advice on the best approach to upgrade a legacy .NET Framework project to a newer version. The project currently consists of over 80 projects, and a complete rewrite would be a time-...
2
votes
3
answers
173
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 ...
4
votes
2
answers
971
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 ...
0
votes
0
answers
98
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 ...
-1
votes
3
answers
204
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 ...
0
votes
1
answer
170
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 ...
0
votes
1
answer
257
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 {
...
5
votes
3
answers
3k
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 ...
2
votes
3
answers
436
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)
{
...
0
votes
1
answer
84
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 ...
1
vote
0
answers
225
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 ...
-3
votes
3
answers
445
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 ...
1
vote
0
answers
285
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 ...
0
votes
0
answers
48
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. ...
0
votes
1
answer
274
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 ...
0
votes
1
answer
94
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 ...
0
votes
1
answer
295
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 ...
2
votes
1
answer
764
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 ...
0
votes
2
answers
565
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 ...
9
votes
2
answers
12k
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 ...
-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 ...
1
vote
1
answer
236
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 ...
1
vote
0
answers
96
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 ...
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 ...
1
vote
1
answer
531
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 ...
5
votes
4
answers
622
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 ...
0
votes
1
answer
250
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, ...
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 ...
-1
votes
2
answers
741
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 ...
0
votes
5
answers
344
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 ...
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<...
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 ...
1
vote
4
answers
3k
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)
{
// ...
...
0
votes
0
answers
534
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 ...
1
vote
1
answer
489
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 ...
2
votes
3
answers
540
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 ...
0
votes
1
answer
648
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 ...
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 ...
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
/...
1
vote
2
answers
808
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 ...
0
votes
0
answers
419
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 ...
18
votes
3
answers
35k
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 ...
-1
votes
1
answer
263
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 ...
1
vote
2
answers
937
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 ...
0
votes
1
answer
2k
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 ...
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....
1
vote
1
answer
124
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 ...
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. ...
0
votes
0
answers
83
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 ...