AccessorExtensions.GetService メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
| Name | 説明 |
|---|---|
| GetService(IInfrastructure<IServiceProvider>, Type) |
IInfrastructure<T>を実装する型から公開されているIServiceProviderからサービスを解決します。 |
| GetService<TService>(IInfrastructure<IServiceProvider>) |
IInfrastructure<T>を実装する型から公開されているIServiceProviderからサービスを解決します。 |
GetService(IInfrastructure<IServiceProvider>, Type)
IInfrastructure<T>を実装する型から公開されているIServiceProviderからサービスを解決します。
[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
パラメーター
- accessor
- IInfrastructure<IServiceProvider>
サービス プロバイダーを公開しているオブジェクト。
- serviceType
- Type
解決するサービスの種類。
戻り値
要求されたサービス。
- 属性
注釈
IInfrastructure<T> は、アプリケーション コードで使用されることを意図していないが、データベース プロバイダーによって記述された拡張メソッドなどで使用できるプロパティを非表示にするために使用されます。
詳細と例については、 DbContext サービスへのアクセス を参照してください。
適用対象
GetService<TService>(IInfrastructure<IServiceProvider>)
IInfrastructure<T>を実装する型から公開されているIServiceProviderからサービスを解決します。
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;
[System.Diagnostics.DebuggerStepThrough]
public static TService GetService<TService>(this Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> accessor);
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service
[<System.Diagnostics.DebuggerStepThrough>]
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service (requires 'Service : null)
[<System.Diagnostics.DebuggerStepThrough>]
static member GetService : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<IServiceProvider> -> 'Service
<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
型パラメーター
- TService
解決するサービスの種類。
パラメーター
- accessor
- IInfrastructure<IServiceProvider>
サービス プロバイダーを公開しているオブジェクト。
戻り値
要求されたサービス。
- 属性
注釈
IInfrastructure<T> は、アプリケーション コードで使用されることを意図していないが、データベース プロバイダーによって記述された拡張メソッドなどで使用できるプロパティを非表示にするために使用されます。
詳細と例については、 DbContext サービスへのアクセス を参照してください。