Sunday, March 25, 2012

What is Inversion of Control?

Inversion of Control allows a project within a solution to access code in a different project from which the first project does not inherit. What is more, the second project may in fact inherit from the first project. StructureMap, Spring.NET, and Ninject! empower IoC and are what is known as IoC containers. There are two varieties of Inversion of Control: Service Locator and Dependency Injection. In Dependency Injection an XML file will denote how a project may find an otherwise inaccessible class for an interface against the flow of inheritance. With Service Locator, there is no such mapping. Instead the application context is crawled by the compiler to find an applicable match, based on naming convention, for a would-be dependency that is called outside of the scope of the current project and the project(s) it inherits from.

No comments:

Post a Comment