WebAssemblyHostBuilder.ConfigureContainer<TBuilder> Method

Definition

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

C#
public void ConfigureContainer<TBuilder> (Microsoft.Extensions.DependencyInjection.IServiceProviderFactory<TBuilder> factory, Action<TBuilder> configure = default);
C#
public void ConfigureContainer<TBuilder> (Microsoft.Extensions.DependencyInjection.IServiceProviderFactory<TBuilder> factory, Action<TBuilder>? configure = default);

Type Parameters

TBuilder

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

Parameters

configure
Action<TBuilder>

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

Remarks

ConfigureContainer<TBuilder>(IServiceProviderFactory<TBuilder>, Action<TBuilder>) is called by Build() and so the delegate provided by configure will run after all other services have been registered.

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

Applies to

Product Versions
ASP.NET Core 3.1, 5.0, 6.0, 7.0, 8.0, 9.0