Project DescriptionA DI container on a diet. This is a basic DI container that lives in your project not an external assembly with support for auto generated delegate factories.
OK, So Why Is This Different To X
The aim when creating OCInject was to create something that can be used in small projects, single exe utilities or one off apps, where you want the advantages of a DI container but without the overhead of Castle, Autofac,
et al. So consider this DI lite, you simply take the two files, IClassFactory.cs and ClassFactory.cs, and drop them in to your project. That’s it, done, no external dependency and no XML config file. What do you get?
Features:
- A DI Container with fluent like configuration
- Ability to resolve constructor parameters for registered types and passed in constructor arguments
- Runtime delegate factory generation
- Pseudo session support via IDisposable.
- Life style management – It’s possible to register types as singletons or instance
- Func<T> factories – You can use Func<TContract> instead of typed delegates
- Largest Resolvable Constructor – It will select the greediest constructor it can resolve. It makes the assumption that any known types are resolvable, for performance reasons.
- Unresolveable Callback – It is possible to supply a call back function if the container can’t resolve a type.
- Child Container Support – OCInject can create child containers that call back to the parent for any unknown types.
The feature list is tiny and is very unlikely to grow.
An introduction and how to use guide can be found at
http://www.humblecoder.co.uk/?p=102 with examples of new features introduced in Release 2 here
http://www.humblecoder.co.uk/?p=128