Wednesday, December 3, 2008

Composite WPF Guidance - Part 3 (Patterns)



The Inversion of Control (IoC) pattern is used to enable extensibility in a class or framework. Inversion of Control (IoC) means that objects do not create other objects on which they rely to do their work. Instead, they get the objects that they need from an outside source (for example, an xml configuration file).
In Composite Application Library the container is provided by implementing the IContainerFacade interface. The above mentioned diagram explains the IoC implementation in CAL.

The Service Locator pattern is a form of the Inversion of Control pattern. It allows classes to locate specific services they are interested in without needing to know who implements the service. Frequently, this is used as an alternative to dependency injection, but there are times when a class will need to use service location instead of dependency injection, such as when it needs to resolve multiple implementers of a service. In the Composite Application Library, this can be seen when ModuleLoader service resolves individual IModules.

No comments: