ServiceCollectionContainerBuilderExtensions.BuildServiceProvider 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
BuildServiceProvider(IServiceCollection) |
從提供的 IServiceCollection建立包含服務的 ServiceProvider。 |
BuildServiceProvider(IServiceCollection, ServiceProviderOptions) |
建立包含所提供 IServiceCollection 服務 ServiceProvider 選擇性地啟用範圍驗證。 |
BuildServiceProvider(IServiceCollection, Boolean) |
建立包含所提供 IServiceCollection 服務 ServiceProvider 選擇性地啟用範圍驗證。 |
BuildServiceProvider(IServiceCollection)
從提供的 IServiceCollection建立包含服務的 ServiceProvider。
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)
建立包含所提供 IServiceCollection 服務 ServiceProvider 選擇性地啟用範圍驗證。
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)
建立包含所提供 IServiceCollection 服務 ServiceProvider 選擇性地啟用範圍驗證。
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
。