Microsoft.Extensions.DependencyInjection

Source
NuGet Package NServiceBus.MSDependencyInjection (1-pre) | License
This is a community maintained project. License and support are independent of Particular Software.
This page targets a pre-release version and is subject to change prior to the final release.

NServiceBus can be configured to use Microsoft.Extensions.DependencyInjection for dependency injection.

Usage

public void ConfigureServices(IServiceCollection services)
{
    // register any services to IServiceCollection

    endpointConfiguration.UseContainer<ServicesBuilder>(customizations =>
    {
        customizations.ExistingServices(services);
    });
}

DependencyLifecycle mapping

DependencyLifecycle maps to Microsoft.Extensions.DependencyInjection service lifetimes as follows:

DependencyLifecycleMicrosoft.Extensions.DependencyInjection service lifetime
InstancePerCallTransient
InstancePerUnitOfWorkScoped
SingleInstanceSingleton

Samples


Last modified