ServiceCollectionContainerBuilderExtensions.BuildServiceProvider 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
BuildServiceProvider(IServiceCollection) |
创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务。 |
BuildServiceProvider(IServiceCollection, ServiceProviderOptions) |
创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。 |
BuildServiceProvider(IServiceCollection, Boolean) |
创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。 |
BuildServiceProvider(IServiceCollection)
创建一个 ServiceProvider,它包含提供的 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
包含服务描述符的 IServiceCollection。
返回
适用于
BuildServiceProvider(IServiceCollection, ServiceProviderOptions)
创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可选择启用服务创建和范围验证。
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
包含服务描述符的 IServiceCollection。
- options
- ServiceProviderOptions
配置各种服务提供程序行为,包括服务创建和范围验证。
返回
适用于
BuildServiceProvider(IServiceCollection, Boolean)
创建一个 ServiceProvider,它包含提供的 IServiceCollection 中的服务,并且可以选择启用范围验证。
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
包含服务描述符的 IServiceCollection。
- validateScopes
- Boolean
执行检查以验证范围内的服务永远不会从根提供程序解析,则为 true
;否则为 false
。