Share via


DbContextOptionsBuilder.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 UseRootApplicationServiceProvider ();
abstract member UseRootApplicationServiceProvider : unit -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.UseRootApplicationServiceProvider : unit -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function UseRootApplicationServiceProvider () As DbContextOptionsBuilder

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 UseRootApplicationServiceProvider (IServiceProvider? rootServiceProvider);
abstract member UseRootApplicationServiceProvider : IServiceProvider -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.UseRootApplicationServiceProvider : IServiceProvider -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function UseRootApplicationServiceProvider (rootServiceProvider As IServiceProvider) As DbContextOptionsBuilder

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