Share via


DbContextOptionsBuilder<TContext>.UseRootApplicationServiceProvider Method

Definition

Overloads

UseRootApplicationServiceProvider()

Resolves the root IServiceProvider from from the scoped application service provider. The root provider can be used to obtain singleton application services from singleton internal services.

UseRootApplicationServiceProvider(IServiceProvider)

Sets the root IServiceProvider from which singleton application services can be obtained from singleton internal services.

UseRootApplicationServiceProvider()

Resolves the root IServiceProvider from from the scoped application service provider. The root provider can be used to obtain singleton application services from singleton internal services.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseRootApplicationServiceProvider ();
override this.UseRootApplicationServiceProvider : unit -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)>
Public Overridable Function UseRootApplicationServiceProvider () As DbContextOptionsBuilder(Of TContext)

Returns

The same builder instance so that multiple calls can be chained.

Remarks

This is an advanced option that is rarely needed by normal applications. Calling this method will result in a new internal service provider being created for every different root application service provider.

See Using DbContextOptions for more information and examples.

Applies to

UseRootApplicationServiceProvider(IServiceProvider)

Sets the root IServiceProvider from which singleton application services can be obtained from singleton internal services.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseRootApplicationServiceProvider (IServiceProvider? rootServiceProvider);
override this.UseRootApplicationServiceProvider : IServiceProvider -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)>
Public Overridable Function UseRootApplicationServiceProvider (rootServiceProvider As IServiceProvider) As DbContextOptionsBuilder(Of TContext)

Parameters

rootServiceProvider
IServiceProvider

The service provider to be used.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

This is an advanced option that is rarely needed by normal applications. Calling this method will result in a new internal service provider being created for every different root application service provider.

See Using DbContextOptions for more information and examples.

Applies to