MetaContainer defines very useful abstraction layer over dependency injection containers and, by doing this, enables developes to write components which are truly independent of DI infrastructure.Introduction
Matacontainer enables developers to configure dependency injection infrastructure without being dependent on particular implementation.
Key Metacontainer use cases include:
When designing the Metacontainer we have decided to define it as an extension to Common Service Locator
. We added following methods:
- Register mapping from service to implementation
- Register mapping from service to implementation creation delegate
- Create child container
As you can see, there are only three new methods added to IServiceLocator
interface and, by adding these methods, a myriad of new usage scenarios are enabled.
By the way, to provide programmer-friendly interface, we also defined a set of extension methods to IMetaContainer
interface. These additional methods provide type-safe equivalents of base methods by using generic parameters.
project was started by us, but it is meant to be developed by the community. We have prepared three most commonly used (as we believe) implementations:
These implementations should be treated as reference implementations whose main goal is to show possibilities of MetaContainer
. We encourage all container implementers to provide their own implementations which, we believe, could be tuned better, than out reference product, to particular container.
On the other hand, although designed as proof-of-concept, implementations provided by us are fully tested and can be safely used in your code and we will make efforts to provide some support for them.