Project Hosting
NuGet NServiceBus.Unity (5.x)
Target NServiceBus Version: 4.x
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.

NServiceBus can be configured to use Unity as a dependency injection container.

Default Usage


Existing Container Instance

var container = new UnityContainer();
container.RegisterInstance(new MyService());

DependencyLifecycle Mapping

The DependencyLifecycle map to Unity in the following way.

DependencyLifecycleUnity Equivalent
InstancePerCallTransient Lifetime Manager
InstancePerUnitOfWorkHierarchical Lifetime Manager
SingleInstanceContainer Controlled Lifetime Manager

Last modified