
NServiceBus, Windsor and message scopes
if you are working with NServiceBus, using as backend IoC container Castle Windsor, remember that under the hood NServiceBus utilizes the Windsor scope feature to create a scope “around” messages in order to isolate dependencies required by each message handler.
In this case if you need to have a component, registered in Windsor, that has its lifestyle bound to the message lifecycle it is enough to register the component using the “LifestyleScope”:
container.Register ( Component.For<MyAmazingComponent>().LifestyleScoped() );
.m