Castle Windsor

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

Default Usage

configure.CastleWindsorBuilder();

Existing 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

Samples


Last modified