You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bartelink edited this page Feb 26, 2012
·
26 revisions
Introduction
The recommended approach to employing an IoC container in a software system is that the Composition Root of the application be the single place where the container is touched directly. Unfortunately, many applications can’t create everything at once at a single point in time as application starts up or at the beginning of each incoming web/WCF request because not everything is known at this moment. These applications need a way to create new instances using the Kernel at a later time. Preferably this is done without introducing a reference to the container. This is where factories come into play. Instead of injecting the kernel into classes that need to create new instances we inject a factory. This factory is responsible to create the new instances using the kernel. There are two ways to implement such a factory: A factory interface and as a Func or Lazy. Both ways are covered by this extension.