Table of Contents

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

entityType IEntityType

The entity type to shape.

innerTable TableExpressionBase

The table from which entity columns are being projected out.

nullable bool

A 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

entityType IEntityType

The entity type to shape.

propertyExpressionMap IDictionary<IProperty, ColumnExpression>

A dictionary of column expressions corresponding to properties of the entity type.

discriminatorExpression SqlExpression

A 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

SqlExpression

EntityType

The entity type being projected out.

public virtual IEntityType EntityType { get; }

Property Value

IEntityType

NodeType

public override sealed ExpressionType NodeType { get; }

Property Value

ExpressionType

Type

public override Type Type { get; }

Property Value

Type

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 INavigation

A navigation to add binding for.

entityShaper EntityShaperExpression

An 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 INavigation

A 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 IProperty

A 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

derivedType IEntityType

A 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

Returns

Expression