AccessorExtensions.GetService Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetService(IInfrastructure<IServiceProvider>, Type) |
Resolves a service from the IServiceProvider exposed from a type that implements IInfrastructure<T>. |
GetService<TService>(IInfrastructure<IServiceProvider>) |
Resolves a service from the IServiceProvider exposed from a type that implements IInfrastructure<T>. |
GetService(IInfrastructure<IServiceProvider>, Type)
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
Resolves a service from the IServiceProvider exposed from a type that implements 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
Parameters
- accessor
- IInfrastructure<IServiceProvider>
The object exposing the service provider.
- serviceType
- Type
The type of service to be resolved.
Returns
The requested service.
- Attributes
Remarks
IInfrastructure<T> is used to hide properties that are not intended to be used in application code but can be used in extension methods written by database providers etc.
See Accessing DbContext services for more information and examples.
Applies to
GetService<TService>(IInfrastructure<IServiceProvider>)
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
- Source:
- AccessorExtensions.cs
Resolves a service from the IServiceProvider exposed from a type that implements 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
Type Parameters
- TService
The type of service to be resolved.
Parameters
- accessor
- IInfrastructure<IServiceProvider>
The object exposing the service provider.
Returns
The requested service.
- Attributes
Remarks
IInfrastructure<T> is used to hide properties that are not intended to be used in application code but can be used in extension methods written by database providers etc.
See Accessing DbContext services for more information and examples.
Applies to
Entity Framework