Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm currently working deeply with DI/IoC in C#/WinForm on VisualStudio2010/12. My choise fall on Castle Windsor, but also StructureMap but is not important what IoCC you use.</p> <p>For a very detailed answer I suggest you to read "Dependency Injection in .NET" by Mark Seemann. That is a good book even if you do not develop in .NET.</p> <p>Regarding your questions:</p> <ol> <li><p>A DI CONTAINER is a library that you can potentially use from wherever you would like—but that doesn’t mean that you should. Although you can spread out the use of the container so that it permeates a large percentage of your classes, you should instead concentrate it into a single area of your application. </p> <p>This place is called the COMPOSITION ROOT and you should only use a DI CONTAINER from within that place. The COMPOSITION ROOT of the application should be located in the application’s root so that it can properly compose the application. You shouldn’t attempt to compose classes in any of the modules because that approach limits your options. All classes in application modules should use CONSTRUCTOR INJECTION (or, in rare cases, one of the other patterns like Property Injection) and leave it up to the COMPOSITION ROOT to compose the application’s object graph. Any DI CONTAINER call should be limited to the COMPOSITION ROOT.</p> <p>The COMPOSITION ROOT can be spread out across a few classes. This is expected—the important thing is that all classes are contained in the same module, which preferebly is the application root.</p></li> <li><p>You are not required to use interfaces everywhere. You can also use concrete classes. Certainly interfaces provide a higher level of abstraction, but you have to consider if you need in your project. For example, it is good practice to use the interface in the business logic in your application.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload