Partager via


IHostApplicationBuilder.ConfigureContainer<TContainerBuilder> Method

Definition

Registers a IServiceProviderFactory<TContainerBuilder> instance to be used to create the IServiceProvider.

public void ConfigureContainer<TContainerBuilder> (Microsoft.Extensions.DependencyInjection.IServiceProviderFactory<TContainerBuilder> factory, Action<TContainerBuilder>? configure = default);
abstract member ConfigureContainer : Microsoft.Extensions.DependencyInjection.IServiceProviderFactory<'ContainerBuilder> * Action<'ContainerBuilder> -> unit
Public Sub ConfigureContainer(Of TContainerBuilder) (factory As IServiceProviderFactory(Of TContainerBuilder), Optional configure As Action(Of TContainerBuilder) = Nothing)

Type Parameters

TContainerBuilder

The type of builder provided by the IServiceProviderFactory<TContainerBuilder>.

Parameters

factory
IServiceProviderFactory<TContainerBuilder>

The factory object that can create the TContainerBuilder and IServiceProvider.

configure
Action<TContainerBuilder>

A delegate used to configure the TContainerBuilder. This can be used to configure services using APIS specific to the IServiceProviderFactory<TContainerBuilder> implementation.

Remarks

The IServiceProvider is created when this builder is built and so the delegate provided by configure will run after all other services have been registered.

Multiple calls to ConfigureContainer<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder>, Action<TContainerBuilder>) will replace the previously stored factory and configure delegate.

Applies to