StructureMap

Source
NuGet Package NServiceBus.StructureMap (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 StructureMap for dependency injection.

Default usage

configure.StructureMapBuilder();

Using an existing container

var container = new Container(
    action: expression =>
    {
        expression.For<MyService>()
            .Use(new MyService());
    });
configure.StructureMapBuilder(container);

DependencyLifecycle Mapping

DependencyLifecycle maps to StructureMap lifecycles as follows:

DependencyLifecycleStructureMap lifecycle
InstancePerCallAlwaysUnique
InstancePerUnitOfWorkContainerScoped
SingleInstanceSingleton

Samples


Last modified