All Questions
Tagged with .net-core dependency-injection
8
questions
4
votes
2
answers
522
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 ...
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 ...
1
vote
0
answers
264
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 ...
2
votes
1
answer
693
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
1
answer
224
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, ...
0
votes
0
answers
355
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 ...
-1
votes
1
answer
227
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 ...
9
votes
1
answer
5k
views
Should .NET Core class libraries register their own implementations?
Our team had recently a big struggle of deciding whether it is a good practice or not for the .NET Core class libraries to register their own implementations by the fact of providing a ...