.net dependency injection framework
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DivineInject.Test
DivineInject
.gitignore
DivineInject.sln
DivineInject.sln.DotSettings
LICENSE
README.md
Settings.StyleCop
build
msbuild.xml
nuget.config

README.md

Divine Inject

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

Why?

Because dependency injection is important - but done wrong it can do more harm than good. DivineInject is opinionated about the right way to use dependency injection:

  • Constructor injection or death

    Setter injection is bad for your health, just say no

  • Dependencies are singletons

    Dependencies are external to your application - your DI framework doesn't need to know about users or sessions or threads.

  • Domain objects can be rich, too

    Your domain model doesn't have to be anemic

Getting Started

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);
}

Documentation

For more documentation and detailed examples, see the documentation.