Inversion of control container with (almost) zero configuration.
The container configuration is validated when the container is built, to make sure that all dependencies have been registered.
Support for .NET Standard 2.0 and .NET 4.5.2.
- Add the
[Component]
attribute on your classes:
[Component]
public class MyService : IShoppingService
{
public MyService(IShoppingRepository repos)
{
}
// [...]
}
[Component]
public class SqlServerShoppingRepository : IShoppingRepository
{
public SqlServerShoppingRepository()
{
}
// [...]
}
- Register all decorated classes in the container:
var registrar = new ContainerRegistrar();
registrar.RegisterComponents(Lifetime.Scoped, Assembly.GetExecutingAssembly());
var container = registrar.Build();
- The usual =)
- Configuration validation
- Commands
- Decorators
- Interceptors
- Modules
- Domain events
- Quick enough
Install using nuget:
- Core:
install-package griffin.container
- MVC5:
install-package griffin.container.mvc5
- WCF:
install-package griffin.container.wcf
- WebApi v2:
install-package griffin.container.webapi2
- The article linked above
- Core MSDN style docs
- WCF MSDN style docs
- Forum/Mailing list
Pull requests are welcome.