DivineInject.GitHub.io

View the Project on GitHub DivineInject

Divine Inject

DivineInject is a .net dependency injection framework, designed to be simple to use and easy to understand.

See how to get started in 30 seconds, find out why we created DivineInject or read more detailed documentation.

Quick Start

First, install the nuget package:

Install-Package DivineInject

Second, wire up your dependencies:

DivineInjector.Current
	.Bind<IDatabaseProvider>().To<MSSQLDatabaseProvider>()
	.Bind<IOrderService>().To<OrderService>();

Third, create your root object:

public object GetInstance(InstanceContext instanceContext, Message message)
{
    return DivineInjector.Current.Get(m_instanceType);
}

This is a snippet from a WCF service's IInstanceProvider implementation, other application types will obviously create their root object differently