Class EntityProjectionExpression
- Namespace
- Microsoft.EntityFrameworkCore.Query
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
An expression that represents an entity in the projection of SelectExpression.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public class EntityProjectionExpression : Expression
- Inheritance
-
EntityProjectionExpression
- Inherited Members
Constructors
EntityProjectionExpression(IEntityType, IReadOnlyDictionary<IProperty, ColumnExpression>, SqlExpression?)
Creates a new instance of the EntityProjectionExpression class.
public EntityProjectionExpression(IEntityType entityType, IReadOnlyDictionary<IProperty, ColumnExpression> propertyExpressionMap, SqlExpression? discriminatorExpression = null)
Parameters
entityType
IEntityTypeAn entity type to shape.
propertyExpressionMap
IReadOnlyDictionary<IProperty, ColumnExpression>A dictionary of column expressions corresponding to properties of the entity type.
discriminatorExpression
SqlExpressionA SqlExpression to generate discriminator for each concrete entity type in hierarchy.
Properties
DiscriminatorExpression
A SqlExpression to generate discriminator for entity type.
public virtual SqlExpression? DiscriminatorExpression { get; }
Property Value
EntityType
The entity type being projected out.
public virtual IEntityType EntityType { get; }
Property Value
- IEntityType
NodeType
public override sealed ExpressionType NodeType { get; }
Property Value
Type
public override Type Type { get; }
Property Value
Methods
AddNavigationBinding(INavigation, EntityShaperExpression)
Adds a navigation binding for this entity projection when the target entity type of the navigation is owned or weak.
public virtual void AddNavigationBinding(INavigation navigation, EntityShaperExpression entityShaper)
Parameters
navigation
INavigationA navigation to add binding for.
entityShaper
EntityShaperExpressionAn entity shaper expression for the target type.
BindNavigation(INavigation)
Binds a navigation with this entity projection to get entity shaper for the target entity type of the navigation which was previously added using AddNavigationBinding(INavigation, EntityShaperExpression) method.
public virtual EntityShaperExpression? BindNavigation(INavigation navigation)
Parameters
navigation
INavigationA navigation to bind.
Returns
- EntityShaperExpression
An entity shaper expression for the target entity type of the navigation.
BindProperty(IProperty)
Binds a property with this entity projection to get the SQL representation.
public virtual ColumnExpression BindProperty(IProperty property)
Parameters
property
IPropertyA property to bind.
Returns
- ColumnExpression
A column which is a SQL representation of the property.
MakeNullable()
Makes entity instance in projection nullable.
public virtual EntityProjectionExpression MakeNullable()
Returns
- EntityProjectionExpression
A new entity projection expression which can project nullable entity.
ToString()
public override string ToString()
Returns
UpdateEntityType(IEntityType)
Updates the entity type being projected out to one of the derived type.
public virtual EntityProjectionExpression UpdateEntityType(IEntityType derivedType)
Parameters
derivedType
IEntityTypeA derived entity type which should be projected.
Returns
- EntityProjectionExpression
A new entity projection expression which has the derived type being projected.
VisitChildren(ExpressionVisitor)
protected override Expression VisitChildren(ExpressionVisitor visitor)
Parameters
visitor
ExpressionVisitor