Questions tagged [asp.net-core]
A free, open source and cross platform web development framework for building .NET web applications.
214 questions
0
votes
1
answer
144
views
How to test load balanced ASP Core based website?
I have a simple ASP Core based website that is connected to my local SQL Server Express, some of the third party plugins used, do have reliance on other products i.e. scheduling timers.
I would like ...
2
votes
2
answers
162
views
Could concurrent user-triggered data fetches and inserts lead to deadlocks in a multi-user ASP.NET Core + MSSQL application?
I'm facing a tricky situation that might result from a not thoroughly thought-out design, and I'm hoping to understand whether a deadlock might be a realistic cause – and if so, how to prevent similar ...
1
vote
3
answers
190
views
Are there non-inheritance-chain-mess ways to make modular libraries that rely on Entity Framework based on one DB context in the using project?
I am developing some modular libraries that contain common APIs, data, and functionality. One of the core assumptions to these libraries is you would use which you want to compose your project, but ...
3
votes
1
answer
443
views
Clean Architecture using interfaces or Mediator approach?
I'm starting a new project and I want to follow a Clean Architecture(ish) approach.
I've modeled my projects in that manner (attached diagram).
For the API I'm using FastEndpoint since I like it, it'...
-2
votes
1
answer
216
views
Best Practices for Managing Multiple Entity Types in ASP.NET Core
I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
0
votes
1
answer
260
views
Best approach to map user roles dynamically in ASP.NET Core Identity register method?
I'm working on an ASP.NET Core application that uses Identity for user management. I have an AccountService with a Register function, where I accept a RegisterBaseDto that contains the role ...
-1
votes
3
answers
214
views
Long running timers that need to survive shutdowns
What is the best way to go about creating an app that waits for a long time before running a task? Let's say I need my application to wait for 1 year and be precise to the second, what would be the ...
1
vote
2
answers
877
views
Best practice for using models between layers in mvc
I'm working on an MVC application using C#/asp. The project is following an n-tier architecture style with a separate data layer, domain layer and presentation layer. My question is related to the use ...
1
vote
5
answers
344
views
Purpose of async/await in web servers when stuck with legacy I/O
A couple days ago I asked about the Purpose of async/await in web servers, and got in-depth answers explaining how in fully asynchronous code, it frees up the CPU completely while also releasing the ...
23
votes
4
answers
9k
views
Purpose of async/await in web servers
I don't understand why I keep seeing async/await recommended (or sometimes, even enforced) for ASP.NET Core web applications and APIs.
As far as I can tell, every request is already being run on a ...
4
votes
2
answers
1k
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 ...
-1
votes
3
answers
288
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
237
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
169
views
DAL class structure for storing and organizing SQL using Dapper?
I'm creating a web application with Asp.Net Core MVC, and I've replaced Entity Framework with a custom data store. I've decided to use Dapper, but have never used it prior to this project. So I'm ...
0
votes
0
answers
119
views
Avoiding conflicts with Microsoft Two-factor authentication across multiple web applications help
I'm designing a web application and using Microsoft's out of the box Identity and its default Two-Factor Authentication (with Asp.net core MVC and .NET 8). While setting up and testing the 2FA ...
2
votes
1
answer
153
views
ASP.NET Core configuration system: Isn't the default configuration prone to naming conflicts in environment variables?
I'm trying to wrap my head around the ASP.NET Core Configuration system.
If I understand the default configuration correctly, non-prefixed environment variables will override appsettings.json entries.
...
0
votes
1
answer
185
views
Validation logic dependencies and separation of concerns
I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, ...
0
votes
2
answers
833
views
What is considered best practice for managing dependency injection for multiple libraries with ASP.NET Core Web API?
Suppose we are building a REST API with ASP.NET Core. Suppose there are 3 projects in our solution:
The ASP.NET Core Web API project.
A class library project for the businnes layer.
A class library ...
0
votes
1
answer
180
views
What C# Object Composition strategy would you apply for CoreObjects with a governing 'ObjectType' property
In a C# ASP.Net Core Web Application I have a Domain Model CentralDesignObject made up of many component objects & properties, producing a significant amount of derived/calculated values.
This ...
0
votes
1
answer
121
views
Why aren't mandatory options requested in the signature of ASP.NET Core "AddXXX" methods?
I've developing a .NET Core library meant to simplify the configuration of the authentication within our SSO system. It will expose two methods to be called in the Program.cs (or Startup.cs) of ASP....
-1
votes
1
answer
224
views
Design of system pushing data to multiple systems
I have a ASP.NET Core backend (with Azure Service Bus) and a Blazor Server frontend.
The purpose of the backend and the frontend is to trigger manual and automatic pushing of single data points (...
5
votes
3
answers
4k
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 ...
0
votes
1
answer
93
views
sql migration - decoupling deployment from execution
We have a .NET c# solution that uses AliaSQL to run database migrations / to build the backend. I have a situation where we need to write some SQL Server logic that will
copy records from Table A to ...
-2
votes
2
answers
3k
views
Chose between .net 4.8.1 and .net core 6.0 . is the support life cycle an important factor to consider
I want to start developing a long-life ERP system to a customer. now on paper I would chose to develop it using .NET core 6.0 with SQL Server. But one of the main drawbacks which the customer did not ...
-1
votes
1
answer
494
views
PowerApps with SharePoint Versus ASP.NET core with SQL Server
I have around 6 years of experience in SharePoint, ASP.NET MVC, ASP.NET Core MVC & SQL Server. Now when I want to take a decision, if the project should be implemented using SharePoint/PowerApps ...
0
votes
1
answer
75
views
Including currect user/roles data within object state in .Net applications to control object behavior
I am building a .Net Core Blazor Server application. The application creates records of a Project class which move through a workflow with various phases of review and acceptance/rejection before ...
8
votes
1
answer
5k
views
Should web API controller actions that perform no async work always be declared as async?
I have been going over our app web api and making sure all async work is async all the way - and no artificial asynchronicity is enforced.
Say I have the following web api controller:
[HttpGet]
...
0
votes
4
answers
218
views
Microservice arcitecture - seperation of services
The Microservice arcitecture is still a new thing for me to work with, so it gives me some unanswered questions.
In my case each MicroService has its own database.
I need a UserService to handle CRUD ...
2
votes
3
answers
538
views
What should we do in face of a failing sub in pub-sub?
I'm working on a microservices application that is implemented from the ground up with MediatR em CQRS. We have a list of domain events that will be published via MediatR [simple pub-sub library that ...
5
votes
1
answer
1k
views
Seeding data into a new microservice
I've been reading though Architecture for containerized .NET applications book, and I have a question about replicating data from from service into another:
And finally (and this is where most of ...
1
vote
1
answer
349
views
Pulling a service out from a modular monolith
I've been looking into the Modular Monolith, especially how it's described by Kamil Gryzbek. From what I understand, the architecture should easily support pulling a single service out from the ...
0
votes
1
answer
119
views
Benefit of using Dependency Injection inside ASP.NET Core MVC
I am reading this article about using DI inside ASP.NET Core @ https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0 .. but i can not understand its ...
2
votes
3
answers
2k
views
Is It Considered Good Practice to Use Dependency Injection with Strategies from a NuGet Package?
I am developing a NuGet package which contains shared code for various ASP.NET Core projects. I am planning to use the strategy pattern to solve the same problem in a few different ways. So there will ...
1
vote
3
answers
2k
views
Domain Driven Design - Aggregate Root and Nested Aggregate Invariants
I've come to a bit of an impasse with the best way to implement a DDD problem, and am hoping for some advice from those with more experience, please.
I have a RecipeCollection, which has a collection ...
-1
votes
1
answer
668
views
REST API designing resources for complex entities
I have an ASP.Net Core Web API where I am having difficulties designing the REST resources based on the EF Entities I have.
There are three entities that describe a Reservation. First, there is the ...
1
vote
1
answer
3k
views
How to handle duplicate validation logic with CQRS pattern
I am implementing a CQRS pattern in ASP.NET Core with MediatR, and I am wondering what the general consensus is for handling duplicate validation logic for queries/commands which operate on the same ...
0
votes
2
answers
466
views
Which strategy to use to create object instances
I have this use case (I've simplified it):
Each student can apply for one or multiple activities. As of now we only have Swimming activity onboarded on the system, but we expect to have more. Base ...
0
votes
2
answers
314
views
Is it bad style to share a Model class between two API Endpoints?
I have the following scenario:
My .NET Core API has two Endpoints CreateProduct and UpdateProduct.
The only difference between the two will be that UpdateProduct will need to know the ID of the ...
1
vote
1
answer
536
views
Testing API with Auth0-enabled user authentication and authorization
I have a REST API and a SPA application, with Auth0 server issuing access tokens and enabling end users to login with their social identity provider. The API expects to receive a JWT access token with ...
1
vote
0
answers
241
views
ASP .NET Core 6 - .razor components - Routing
I come from a background in ASP.NET MVC 5 on .NET 4.8.
I've been trying to wrap my head around the new razor pages, and can't seem to get routing to work, or understand it, even.
I don't want to use ...
2
votes
1
answer
1k
views
In an MVC Application, What Goes Where?
In an Model-View-Controller (MVC) design pattern, What goes where? What code goes to model and to controller?
I know (do I?) that business logic should be define in a model, but a lot of example I ...
1
vote
0
answers
321
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
2
answers
535
views
Is it safe to use the same IoC container for your own and third-party services?
I am developing an application with ASP.NET Core with the ability to dynamically add new libraries that implement the necessary functions. They can be included at the start.
I have already written ...
5
votes
5
answers
20k
views
Is it a bad practice to use Singleton for DI in Asp.net rather than Scoped, Transient whenever possible?
We had a conversation (with coworkers) about why we needed to use Singleton for Controller, Business Services, and Repositories.
The reason for this, they claim, is because singleton ensures that code ...
2
votes
2
answers
2k
views
CQRS MediatR Create many items commad - is it a good practise?
I am here to ask question about:
is it good practice to insert many records using CQRS and MediatR?
how to structure that in terms of names and folders?
A have to insert into database over 500 ...
2
votes
1
answer
3k
views
How to unit test public method which internally calls many internal or private methods which are already individually unit tested [duplicate]
In our ASP.NET Core application, we have many APIs which are calling public method from the service class. Service class is implementing an Interface. Each service method (depending upon complexity ...
0
votes
2
answers
1k
views
Where to internationalize emails in a DDD application?
I am building an application with ASP.NET Core 5.0 following DDD and the CQRS pattern. I internationalize on the presentational layer but when I send emails I send them in the application layer via an ...
1
vote
2
answers
3k
views
One API or Two APIs one for internal use and the other for external use
I follow the Layered architecture Like this:
But with two differences:
I use Blazor Assembly for UI Layer.
I have API layer(REST) In between the presentation layer and the service layer.
My ...
0
votes
1
answer
130
views
How best to structure this MVC or Razor Pages web application given a required tcp/ip server data source that acts like a web api?
I am rewriting an old asp.net 4.0 web forms website that exposes an application's data and logic to the web. I am moving this to a .net core mvc or razor page project. The website has minimal ...
1
vote
1
answer
2k
views
ASP.NET Core - Using Partial Views inside a Modal window for my Add/Edit/View Details screens?
I've been developing .NET projects for the past 3 years, and on my recent web .NET projects, I've been using Partial Views for all the screens that contain Forms for Add/Update/Delete or other ...