blog
blog copied to clipboard
Using dependency injection in multiple .NET Core projects
Using dependency injection in multiple .NET Core projects
https://asp.net-hacker.rocks/2017/03/06/using-dependency-injection-in-multiple-projects.html
This is a neat approach - just what I needed to avoid having to add logical project references to indirect dependencies. :)
How would this be done if one of the projects was a class library that does not have a program.cs or StartUp.cs but still need to have the db and setting json injected into some of the library classes?
Hi @KCRotaryUSA This is exactly what I tried to explain here. At least you would have one single project in your solution that has a program.cs or a startup.cs. A project that uses your libraries. This project will set up the DI and arrange/compose the dependencies. This will also set up the classes of the class libraries that is depending on a db connection or a settings class that needs to be injected.