Questions tagged [asp.net-core]

A free, open source and cross platform web development framework for building .NET web applications.

Filter by
Sorted by
Tagged with
4 votes
3 answers
193 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
  • 149
0 votes
1 answer
49 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 ...
dot's user avatar
  • 523
-3 votes
2 answers
210 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 ...
microsoftdeveloperdesigner's user avatar
-1 votes
1 answer
66 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 ...
microsoftdeveloperdesigner's user avatar
0 votes
1 answer
54 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 ...
aterbo's user avatar
  • 111
3 votes
1 answer
691 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] ...
Veverke's user avatar
  • 361
0 votes
4 answers
147 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 ...
Martin C's user avatar
2 votes
3 answers
340 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 ...
underthevoid's user avatar
3 votes
1 answer
728 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 ...
Q-bertsuit's user avatar
1 vote
1 answer
204 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 ...
Q-bertsuit's user avatar
0 votes
1 answer
85 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 ...
test test's user avatar
0 votes
3 answers
719 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 ...
Treker's user avatar
  • 151
1 vote
3 answers
499 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 ...
danwag's user avatar
  • 119
0 votes
1 answer
289 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 ...
J.Paravicini's user avatar
1 vote
1 answer
1k 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 ...
Mark Lisoway's user avatar
0 votes
2 answers
289 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 ...
Juanma's user avatar
  • 109
0 votes
2 answers
115 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 ...
Dario's user avatar
  • 535
1 vote
1 answer
315 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 ...
0lt's user avatar
  • 113
1 vote
0 answers
154 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 ...
Allen Clark Copeland Jr's user avatar
2 votes
1 answer
383 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 ...
careLess's user avatar
0 votes
0 answers
208 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
2 answers
296 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 ...
Ramir Gimaltdinov's user avatar
4 votes
5 answers
8k 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 ...
Udemytur's user avatar
2 votes
2 answers
856 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 ...
Grzegorz G.'s user avatar
1 vote
1 answer
2k 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 ...
WAQ's user avatar
  • 113
0 votes
2 answers
735 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 ...
Carlos's user avatar
  • 21
1 vote
2 answers
915 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 ...
Anyname Donotcare's user avatar
0 votes
1 answer
81 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 ...
Zevias's user avatar
  • 9
0 votes
1 answer
629 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 ...
hds's user avatar
  • 1
0 votes
0 answers
635 views

add web api endpoint, which return html from view

I have ASP.NET 5 Web Api and need to do the following task: Add endpoint, which get cshtml page and return generated html, so it should do the same what is does razor view engine. What is better way ...
Alexan's user avatar
  • 249
0 votes
0 answers
26 views

Design a multiple Asp.Net Core apps Solution

I am having an .Net Core Solution consisting of 3 Projects: The Site (Asp.Net Core MVC WebApp) The API (Asp.Net Core API) The "Common" library for shared functionality. The Common library ...
Mats's user avatar
  • 163
0 votes
2 answers
188 views

Extend the ApplicationUser class or use a Person class?

I am making a web system using Asp.Net Core with individual user accounts (Identity), and I was thinking about how I should store the users' personal information in the database. The system will have ...
Stian's user avatar
  • 131
0 votes
1 answer
723 views

Replacing in-memory queue with messaging queue service

In our application (ASP.NET core) we have events that require computations and which results need to be persisted in a database (the objects are projects that need recalculations when a property ...
Superman.Lopez's user avatar
1 vote
1 answer
3k views

why controller lifetime is transient by default in asp.net core? [closed]

I know the lifetime of the controller class is transient by default, but I think it's better to be singleton. should explain to me why creators choose transient instead of singleton or scope lifetime? ...
Mujan's user avatar
  • 41
2 votes
2 answers
850 views

What is suggested way to use iHostedService of .NET core or Windows service when process runs for exponential hour time (up till hours)?

I wanted to create a background job in which I want to use the retry mechanism for that I want to use the Polly. My requirement is like this: the First retry should be done after 2 hours the Second ...
Hardipsinh Jadeja's user avatar
0 votes
1 answer
32 views

Getting sums of multiple leveled relations efficiently

I'm currently building an API and a web app for an internal warehouse system using NET Core. I have the core entity structure, that goes like this: "Material" has many "MaterialSubtypes&...
Valhaal's user avatar
  • 13
0 votes
2 answers
60 views

Strategy for Chrome timing out on a Database cleanup job which takes a long time

I have a notifications app which sends users notifications. It uses a .NET core backend, an angular frontend and Cosmos DB. Within this I have an API endpoint function which is linked to a button used ...
Watchdogs1499's user avatar
0 votes
1 answer
287 views

Session Scoped Dependency Injection vs Caching in Data Access Layer

The issue at hand is that I don't want to repeatedly hit the DB to look up user information for the logged in user over the course of the many requests made within a single session. My first ...
BVernon's user avatar
  • 459
0 votes
1 answer
474 views

Web Components/Redux with .NET Core MVC viable?

I'm currenty building several new themes using NopCommerce, a .NET e-commerce platform using the MVC architecture. NopCommerce exposes a lot of services to you for communicating with the db, and is ...
Kim Skogsmo's user avatar
0 votes
1 answer
260 views

Managing Documentation / Source Control for a Full-Stack Application Across Multiple Repos

TL;DR I have a moderately sized/complexity web application (Angular 11) in one repo and a standalone REST API (.NET Core 3 / C#) in another repo, and am trying to figure out the most efficient way to ...
Kurtis Jungersen's user avatar
1 vote
1 answer
68 views

Deisgn Pattern: How to map UI requests to Controllers to Services?

I'm learning about writing WebApi design patterns. I am trying to create a simple CRUD web app with ReactJS UI and C# .NET CORE webapi with sql backend. Articles show that specific Repositories are a ...
klau's user avatar
  • 21
3 votes
1 answer
508 views

ASP.NET MVC Caching of ViewModels

My question is regarding caching and ViewModels in ASP.NET (Core) MVC. I have a service which injects a Repository<T> which is used to fetch domain models from the database. The service layer ...
Duane's user avatar
  • 139
1 vote
0 answers
47 views

How to implement timing-mechanism for fantasy draft process utilizing ASP.NET Core 3.1 SignalR

I have developed a Fantasy Draft system utilizing ASP.NET Core SignalR, along with Azure's SignalR service (for backplane/scaling stuff). Last year I utilized a poor-mans' javascript version that just ...
ganders's user avatar
  • 411
0 votes
1 answer
224 views

Should I decouple domain models from IIdentity in ASP.NET core?

I saw a lot of examples of decoupling domain models from Identity models. For my knowledge, currently IIdentity is included in standard .NET library, so is this actual now and should I follow this ...
FoxPro's user avatar
  • 111
0 votes
4 answers
442 views

What problems could be caused by inserting into a database on an HTTP GET?

I have code that checks if the scanned qr code exist in the database and if it exist it will insert data into another table but I did it in the HTTP GET request, is this alright to do it this way or ...
James Ariel Indo Pates's user avatar
5 votes
4 answers
411 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
1 vote
1 answer
710 views

Do I need a service layer if my current service layer looks like this? Also asking about other basic controller service-repository patterns questions

I currently have a service class RoutineService.cs that contains methods that each perform one thing, call the repository and return that exact same object. With how simple it is, is my service ...
John's user avatar
  • 19
-1 votes
3 answers
609 views

Preventing presentation layer from directly accessing repositories?

I'm trying to design my application in line with the "onion architecture" principles, and have something like the following: HospitalController (depends on IHospitalService) \ --- ...
Jez's user avatar
  • 1,288
0 votes
1 answer
1k views

Best practice for pulling bulk data from APIs and storing in database

I have written a small application using ASP.NET Core to create and manage collections of cards for a collectable card game. I currently have a version that successfully downloads bulk card data via ...
DogoPilot's user avatar
0 votes
1 answer
102 views

Implementing the microservice pattern

We are developing a system that runs a certain kind of simulation for our customers: Every simulation runs on it's own server. We typically have a two digit number of simulations running. A client ...
Q-bertsuit's user avatar