I should register DI.
private static void Initialize(ContainerBuilder builder)
{
builder.RegisterType<Logger>().As<ILogger>().SingleInstance();
//...
}
And this is clear to me.
But what if I have 17 projects in my solution.
Projects are related, one project is web project, some projects are providers, some projects are libraries, Core project etc.
For example:
in Project1, I have class_A1 and this class should inject Class_A2 from same project
in Project2, I have class_B1 and this class should inject Class_B2 from same project
in Project3, I have class_C1 and this class should inject Class_C2 from same project
...
in Project17, I have class_K1 and this class should inject Class_K2 from same project
Of course I have some complicated scenarios, like inject class from Project3 to Project14 etc.
Should I do registration in every project separately? Or there is better way?
Thanks for help.
You don't need to register types in every project if all the projects are part of a same solution. Generally in any solution, you will have one main project which I would expect to use all of the other projects in your solution and you can add your registration in the main project.
But in some solution you may have projects that are not directly referred by main project, if this is the case then you have two options IMHO