Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can't talk specifically about converting Spring.NET to Ninject, but in general, all application code should be written to be <strong>DI Container-agnostic</strong>.</p> <p>The best way to think about DI Containers is the <a href="http://en.wikipedia.org/wiki/Hollywood_principle" rel="nofollow noreferrer">Hollywood Principle</a>. In DI terms, it becomes, <strong>don't call the DI Container, it'll call you</strong>.</p> <p>In other words, the best application of DI is to use simple patterns such as <strong>Constructor Injection</strong> and <strong>Abstract Factory</strong>.</p> <p>Most DI Containers worth their salt inherently understand these patterns, so no special, DI Container-specific, jumping through hoops should be needed.</p> <p>This also means that ideally, you should only have DI Container-specific code in a single file in your application. This place is called the <strong>Composition Root</strong>, and this is where the DI Container wires up the entire object graph and gets out of the way.</p> <p>If you follow this principle, you can easily exchange one DI Container for another.</p> <p>The following posts have more details:</p> <ul> <li><a href="https://stackoverflow.com/questions/1475575/where-should-i-do-dependency-injection-with-ninject-2/1475861#1475861">Where should I do Injection with Ninject 2+ (and how do I arrange my Modules?)</a></li> <li><a href="https://stackoverflow.com/questions/1410719/design-where-should-objects-be-registered-when-using-windsor/1410738#1410738">Design - Where should objects be registered when using Windsor</a> </li> </ul>
 

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