c# - Where to register dependency injection when have multiple projects? -


i should register di.

    private static void initialize(containerbuilder builder)     {         builder.registertype<logger>().as<ilogger>().singleinstance();         //...     } 

and clear me. if have 17 projects in solution. projects related, 1 project web project, projects providers, projects libraries, core project etc. example:

in project1, have class_a1 , class should inject class_a2 same project
in project2, have class_b1 , class should inject class_b2 same project
in project3, have class_c1 , class should inject class_c2 same project
...
in project17, have class_k1 , class should inject class_k2 same project

of course have complicated scenarios, inject class project3 project14 etc.
should registration in every project separately? or there better way?
help.

you don't need register types in every project if projects part of same solution. in solution, have 1 main project expect use of other projects in solution , can add registration in main project.

but in solution may have projects not directly referred main project, if case have 2 options imho

  1. you can add other projects reference main project , register types in main project or
  2. you can create new project, say, infrastructure , add projects reference infrastructure project , register types , add infrastructure reference main project , call method takes care of type registration main project.

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -