Partager via


ServiceCollectionContainerBuilderExtensions.BuildServiceProvider Method

Definition

Overloads

BuildServiceProvider(IServiceCollection)

Creates a ServiceProvider containing services from the provided IServiceCollection.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

BuildServiceProvider(IServiceCollection, Boolean)

Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

BuildServiceProvider(IServiceCollection)

Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs

Creates a ServiceProvider containing services from the provided IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::ServiceProvider ^ BuildServiceProvider(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member BuildServiceProvider : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.ServiceProvider
<Extension()>
Public Function BuildServiceProvider (services As IServiceCollection) As ServiceProvider

Parameters

services
IServiceCollection

The IServiceCollection containing service descriptors.

Returns

The ServiceProvider.

Applies to

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs

Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::ServiceProvider ^ BuildServiceProvider(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::DependencyInjection::ServiceProviderOptions ^ options);
public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.DependencyInjection.ServiceProviderOptions options);
static member BuildServiceProvider : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.DependencyInjection.ServiceProviderOptions -> Microsoft.Extensions.DependencyInjection.ServiceProvider
<Extension()>
Public Function BuildServiceProvider (services As IServiceCollection, options As ServiceProviderOptions) As ServiceProvider

Parameters

services
IServiceCollection

The IServiceCollection containing service descriptors.

options
ServiceProviderOptions

Configures various service provider behaviors.

Returns

The ServiceProvider.

Applies to

BuildServiceProvider(IServiceCollection, Boolean)

Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs
Source:
ServiceCollectionContainerBuilderExtensions.cs

Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::ServiceProvider ^ BuildServiceProvider(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, bool validateScopes);
public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, bool validateScopes);
static member BuildServiceProvider : Microsoft.Extensions.DependencyInjection.IServiceCollection * bool -> Microsoft.Extensions.DependencyInjection.ServiceProvider
<Extension()>
Public Function BuildServiceProvider (services As IServiceCollection, validateScopes As Boolean) As ServiceProvider

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

The ServiceProvider.

Applies to