Delen via


DbContextOptionsBuilder.UseApplicationServiceProvider Method

Definition

Sets the IServiceProvider from which application services will be obtained. This is done automatically when using 'AddDbContext' or 'AddDbContextPool', so it is rare that this method needs to be called.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseApplicationServiceProvider (IServiceProvider serviceProvider);
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseApplicationServiceProvider (IServiceProvider? serviceProvider);
abstract member UseApplicationServiceProvider : IServiceProvider -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.UseApplicationServiceProvider : IServiceProvider -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function UseApplicationServiceProvider (serviceProvider As IServiceProvider) As DbContextOptionsBuilder

Parameters

serviceProvider
IServiceProvider

The service provider to be used.

Returns

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

Remarks

See Using DbContextOptions for more information and examples.

Applies to