Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ServiceCollectionContainerBuilderExtensions.BuildServiceProvider Method

Definition

Namespace:
Microsoft.Extensions.DependencyInjection
Assembly:
Microsoft.Extensions.DependencyInjection.dll
Package:
Microsoft.Extensions.DependencyInjection v11.0.0-preview.5.26302.115

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
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
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
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
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


Feedback

Was this page helpful?