Sdílet prostřednictvím


AccessorExtensions.GetService Metoda

Definice

Přetížení

GetService(IInfrastructure<IServiceProvider>, Type)

Vyřeší službu z vystaveného IServiceProvider typu, který implementuje IInfrastructure<T>.

GetService<TService>(IInfrastructure<IServiceProvider>)

Vyřeší službu z vystaveného IServiceProvider typu, který implementuje IInfrastructure<T>.

GetService(IInfrastructure<IServiceProvider>, Type)

Vyřeší službu z vystaveného IServiceProvider typu, který implementuje IInfrastructure<T>.

[System.Diagnostics.DebuggerStepThrough]
public static object GetService (this Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> accessor, Type serviceType);
[<System.Diagnostics.DebuggerStepThrough>]
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> * Type -> obj
<Extension()>
Public Function GetService (accessor As IInfrastructure(Of IServiceProvider), serviceType As Type) As Object

Parametry

accessor
IInfrastructure<IServiceProvider>

Objekt, který zpřístupňuje poskytovatele služeb.

serviceType
Type

Typ služby, která se má vyřešit.

Návraty

Požadovaná služba.

Atributy

Poznámky

IInfrastructure<T> Slouží ke skrytí vlastností, které nejsou určeny k použití v kódu aplikace, ale mohou být použity v rozšiřujících metodách napsaných zprostředkovateli databáze atd.

Další informace a příklady najdete v tématu Přístup ke službám DbContext .

Platí pro

GetService<TService>(IInfrastructure<IServiceProvider>)

Vyřeší službu z vystaveného IServiceProvider typu, který implementuje IInfrastructure<T>.

public static TService GetService<TService> (this Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> accessor);
[System.Diagnostics.DebuggerStepThrough]
public static TService GetService<TService> (this Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> accessor);
[System.Diagnostics.DebuggerStepThrough]
public static TService GetService<TService> (this Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> accessor) where TService : class;
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service
[<System.Diagnostics.DebuggerStepThrough>]
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service
[<System.Diagnostics.DebuggerStepThrough>]
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetService(Of TService) (accessor As IInfrastructure(Of IServiceProvider)) As TService
<Extension()>
Public Function GetService(Of TService As Class) (accessor As IInfrastructure(Of IServiceProvider)) As TService

Parametry typu

TService

Typ služby, která se má vyřešit.

Parametry

accessor
IInfrastructure<IServiceProvider>

Objekt, který zpřístupňuje poskytovatele služeb.

Návraty

TService

Požadovaná služba.

Atributy

Poznámky

IInfrastructure<T> Slouží ke skrytí vlastností, které nejsou určeny k použití v kódu aplikace, ale mohou být použity v rozšiřujících metodách napsaných zprostředkovateli databáze atd.

Další informace a příklady najdete v tématu Přístup ke službám DbContext .

Platí pro