Castle Windsor

Project Hosting
NuGet Package NServiceBus.CastleWindsor (4.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 Castle Windsor as a dependency injection container.

Default Usage

configure.CastleWindsorBuilder();

Existing Container Instance

var container = new WindsorContainer();
var registration = Component.For<MyService>()
    .Instance(new MyService());
container.Register(registration);
configure.CastleWindsorBuilder(container);

DependencyLifecycle Mapping

The DependencyLifecycle map to Castle LifestyleType in the following way.

DependencyLifecycleCastle LifestyleType
InstancePerCallTransient
InstancePerUnitOfWorkScoped
SingleInstanceSingleton

Last modified