ServiceCollectionContainerBuilderExtensions.BuildServiceProvider 方法

定义

重载

BuildServiceProvider(IServiceCollection)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务。Creates a ServiceProvider containing services from the provided IServiceCollection.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling service-creation and scope validation.

BuildServiceProvider(IServiceCollection, Boolean)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling scope validation.

BuildServiceProvider(IServiceCollection)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务。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

参数

services
IServiceCollection

包含服务描述符的 IServiceCollectionThe IServiceCollection containing service descriptors.

返回

ServiceProvider

ServiceProviderThe ServiceProvider.

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。Creates a ServiceProvider containing services from the provided IServiceCollection optionally enabling service-creation and 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

参数

services
IServiceCollection

包含服务描述符的 IServiceCollectionThe IServiceCollection containing service descriptors.

options
ServiceProviderOptions

配置各种服务提供程序行为,包括服务创建和范围验证。Configures various service provider behaviors including service-creation and scope validation.

返回

ServiceProvider

ServiceProviderThe ServiceProvider.

BuildServiceProvider(IServiceCollection, Boolean)

创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。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

参数

services
IServiceCollection

包含服务描述符的 IServiceCollectionThe IServiceCollection containing service descriptors.

validateScopes
Boolean

执行检查以验证范围内的服务永远不会从根提供程序解析,则为 true;否则为 falsetrue to perform check verifying that scoped services never gets resolved from root provider; otherwise, false.

返回

ServiceProvider

ServiceProviderThe ServiceProvider.

适用于