Castle Windsor

Source
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();

Using an existing container

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

DependencyLifecycle Mapping

DependencyLifecycle maps to Castle's LifestyleType as follows:

DependencyLifecycleLifestyleType
InstancePerCallTransient
InstancePerUnitOfWorkScoped
SingleInstanceSingleton

Samples


Last modified