Project Hosting
NuGet NServiceBus.Unity (3.x)
Target NServiceBus Version: 3.x
Standard support for version 3.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