ServiceCollectionContainerBuilderExtensions.BuildServiceProvider Method

Definition

Overloads

BuildServiceProvider(IServiceCollection)

Creates an IServiceProvider containing services from the provided IServiceCollection.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

Creates an IServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

BuildServiceProvider(IServiceCollection, Boolean)

Creates an IServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

BuildServiceProvider(IServiceCollection)

Creates an IServiceProvider containing services from the provided IServiceCollection.

public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
Parameters
services
IServiceCollection

The IServiceCollection containing service descriptors.

Returns

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

Creates an IServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.DependencyInjection.ServiceProviderOptions options);
Parameters
services
IServiceCollection

The IServiceCollection containing service descriptors.

options
ServiceProviderOptions

Configures various service provider behaviors.

Returns

BuildServiceProvider(IServiceCollection, Boolean)

Creates an IServiceProvider containing services from the provided IServiceCollection optionaly enabling scope validation.

public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, bool validateScopes);
Parameters
services
IServiceCollection

The IServiceCollection containing service descriptors.

validateScopes
Boolean

true to perform check verifying that scoped services never gets resolved from root provider; otherwise false.

Returns

Applies to