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, TableExpressionBase, bool)
Creates a new instance of the EntityProjectionExpression class.
[Obsolete("Use the constructor which takes populated column expressions map.", true)]
public EntityProjectionExpression(IEntityType entityType, TableExpressionBase innerTable, bool nullable)
Parameters
entityTypeIEntityTypeThe entity type to shape.
innerTableTableExpressionBaseThe table from which entity columns are being projected out.
nullableboolA bool value indicating whether this entity instance can be null.
EntityProjectionExpression(IEntityType, IDictionary<IProperty, ColumnExpression>, SqlExpression)
Creates a new instance of the EntityProjectionExpression class.
public EntityProjectionExpression(IEntityType entityType, IDictionary<IProperty, ColumnExpression> propertyExpressionMap, SqlExpression discriminatorExpression = null)
Parameters
entityTypeIEntityTypeThe entity type to shape.
propertyExpressionMapIDictionary<IProperty, ColumnExpression>A dictionary of column expressions corresponding to properties of the entity type.
discriminatorExpressionSqlExpressionA 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
navigationINavigationA navigation to add binding for.
entityShaperEntityShaperExpressionAn 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
navigationINavigationA 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
propertyIPropertyA 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.
UpdateEntityType(IEntityType)
Updates the entity type being projected out to one of the derived type.
public virtual EntityProjectionExpression UpdateEntityType(IEntityType derivedType)
Parameters
derivedTypeIEntityTypeA 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
visitorExpressionVisitor