Condividi tramite


AccessorExtensions.GetService Metodo

Definizione

Overload

GetService(IInfrastructure<IServiceProvider>, Type)

Risolve un servizio dall'oggetto IServiceProvider esposto da un tipo che implementa IInfrastructure<T>.

GetService<TService>(IInfrastructure<IServiceProvider>)

Risolve un servizio dall'oggetto IServiceProvider esposto da un tipo che implementa IInfrastructure<T>.

GetService(IInfrastructure<IServiceProvider>, Type)

Risolve un servizio dall'oggetto IServiceProvider esposto da un tipo che implementa 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

Parametri

accessor
IInfrastructure<IServiceProvider>

Oggetto che espone il provider di servizi.

serviceType
Type

Tipo di servizio da risolvere.

Restituisce

Servizio richiesto.

Attributi

Commenti

IInfrastructure<T> viene usato per nascondere le proprietà che non devono essere usate nel codice dell'applicazione, ma possono essere usate nei metodi di estensione scritti dai provider di database e così via.

Per altre informazioni ed esempi, vedere Accesso ai servizi DbContext .

Si applica a

GetService<TService>(IInfrastructure<IServiceProvider>)

Risolve un servizio dall'oggetto IServiceProvider esposto da un tipo che implementa 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

Parametri di tipo

TService

Tipo di servizio da risolvere.

Parametri

accessor
IInfrastructure<IServiceProvider>

Oggetto che espone il provider di servizi.

Restituisce

TService

Servizio richiesto.

Attributi

Commenti

IInfrastructure<T> viene usato per nascondere le proprietà che non devono essere usate nel codice dell'applicazione, ma possono essere usate nei metodi di estensione scritti dai provider di database e così via.

Per altre informazioni ed esempi, vedere Accesso ai servizi DbContext .

Si applica a