DbContextOptionsBuilder.UseRootApplicationServiceProvider Method

Definition

Overloads

UseRootApplicationServiceProvider(IServiceProvider)

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

UseRootApplicationServiceProvider()

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

UseRootApplicationServiceProvider(IServiceProvider)

Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs

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

C#
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseRootApplicationServiceProvider (IServiceProvider? rootServiceProvider);

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

Entity Framework Core 9.0 i Entity Framework Core 8.0
Proizvod Verzije
Entity Framework Core 8.0, 9.0

UseRootApplicationServiceProvider()

Source:
DbContextOptionsBuilder.cs
Source:
DbContextOptionsBuilder.cs

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

C#
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseRootApplicationServiceProvider ();

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

Entity Framework Core 9.0 i Entity Framework Core 8.0
Proizvod Verzije
Entity Framework Core 8.0, 9.0