Class AccessorExtensions
- Namespace
- Microsoft.EntityFrameworkCore.Infrastructure
- Assembly
- Microsoft.EntityFrameworkCore.dll
Extension methods for IInfrastructure<T>.
These methods are typically used by database providers (and other extensions). They are generally not used in application code.
public static class AccessorExtensions
- Inheritance
-
AccessorExtensions
- Inherited Members
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.
Methods
GetInfrastructure<T>(IInfrastructure<T>)
Gets the value from a property that is being hidden using IInfrastructure<T>.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static T GetInfrastructure<T>(this IInfrastructure<T> accessor)
Parameters
accessor
IInfrastructure<T>The object that exposes the property.
Returns
- T
The object assigned to the property.
Type Parameters
T
The type of the property being hidden by IInfrastructure<T>.
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.
GetService(IInfrastructure<IServiceProvider>, Type)
Resolves a service from the IServiceProvider exposed from a type that implements IInfrastructure<T>.
public static object GetService(this IInfrastructure<IServiceProvider> accessor, Type serviceType)
Parameters
accessor
IInfrastructure<IServiceProvider>The object exposing the service provider.
serviceType
TypeThe type of service to be resolved.
Returns
- object
The requested service.
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.
GetService<TService>(IInfrastructure<IServiceProvider>)
Resolves a service from the IServiceProvider exposed from a type that implements IInfrastructure<T>.
public static TService GetService<TService>(this IInfrastructure<IServiceProvider> accessor) where TService : class
Parameters
accessor
IInfrastructure<IServiceProvider>The object exposing the service provider.
Returns
- TService
The requested service.
Type Parameters
TService
The type of service to be resolved.
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.