Interface IEntityMaterializerSource
- Namespace
- Microsoft.EntityFrameworkCore.Query
- Assembly
- Microsoft.EntityFrameworkCore.dll
Defines a source for generating Expression trees that read values from a ValueBuffer or creates entity instances.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IEntityMaterializerSource
Remarks
The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.
See Implementation of database providers and extensions and How EF Core queries work for more information and examples.
Methods
CreateMaterializeExpression(IEntityType, string, Expression)
Creates an Expression tree representing creating an entity instance.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
[Obsolete("Use the overload that accepts an EntityMaterializerSourceParameters object.")]
Expression CreateMaterializeExpression(IEntityType entityType, string entityInstanceName, Expression materializationExpression)
Parameters
entityType
IEntityTypeThe entity type being materialized.
entityInstanceName
stringThe name of the instance being materialized.
materializationExpression
ExpressionThe materialization expression to build on.
Returns
- Expression
An expression to read the value.
CreateMaterializeExpression(EntityMaterializerSourceParameters, Expression)
Creates an Expression tree representing creating an entity instance.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
Expression CreateMaterializeExpression(EntityMaterializerSourceParameters parameters, Expression materializationExpression)
Parameters
parameters
EntityMaterializerSourceParametersParameters for the entity being materialized.
materializationExpression
ExpressionThe materialization expression to build on.
Returns
- Expression
An expression to read the value.
GetEmptyMaterializer(IEntityType)
Returns a cached delegate that creates empty instances of the given entity type.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
Func<MaterializationContext, object> GetEmptyMaterializer(IEntityType entityType)
Parameters
entityType
IEntityTypeThe entity type being materialized.
Returns
- Func<MaterializationContext, object>
A delegate to create instances.
GetMaterializer(IEntityType)
Returns a cached delegate that creates instances of the given entity type.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
Func<MaterializationContext, object> GetMaterializer(IEntityType entityType)
Parameters
entityType
IEntityTypeThe entity type being materialized.
Returns
- Func<MaterializationContext, object>
A delegate to create instances.