Share via


DbExpressionBuilder.RefFromKey Method

Definition

Overloads

RefFromKey(EntitySet, DbExpression)

Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

RefFromKey(EntitySet, DbExpression, EntityType)

Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

RefFromKey(EntitySet, DbExpression)

Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

public static System.Data.Entity.Core.Common.CommandTrees.DbRefExpression RefFromKey (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, System.Data.Entity.Core.Common.CommandTrees.DbExpression keyRow);
static member RefFromKey : System.Data.Entity.Core.Metadata.Edm.EntitySet * System.Data.Entity.Core.Common.CommandTrees.DbExpression -> System.Data.Entity.Core.Common.CommandTrees.DbRefExpression

Parameters

entitySet
EntitySet

The Entity set in which the referenced element resides.

keyRow
DbExpression

A DbExpression that constructs a record with columns that match (in number, type, and order) the Key properties of the referenced Entity type.

Returns

A new DbRefExpression that references the element with the specified key values in the given Entity set.

Exceptions

entitySet or keyRow is null.

keyRow does not have a record result type that matches the key properties of the referenced entity set's entity type.

Applies to

RefFromKey(EntitySet, DbExpression, EntityType)

Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

public static System.Data.Entity.Core.Common.CommandTrees.DbRefExpression RefFromKey (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, System.Data.Entity.Core.Common.CommandTrees.DbExpression keyRow, System.Data.Entity.Core.Metadata.Edm.EntityType entityType);
static member RefFromKey : System.Data.Entity.Core.Metadata.Edm.EntitySet * System.Data.Entity.Core.Common.CommandTrees.DbExpression * System.Data.Entity.Core.Metadata.Edm.EntityType -> System.Data.Entity.Core.Common.CommandTrees.DbRefExpression

Parameters

entitySet
EntitySet

The Entity set in which the referenced element resides.

keyRow
DbExpression

A DbExpression that constructs a record with columns that match (in number, type, and order) the Key properties of the referenced Entity type.

entityType
EntityType

The type of the Entity that the reference should refer to.

Returns

A new DbRefExpression that references the element with the specified key values in the given Entity set.

Exceptions

entitySet, keyRow or entityType is null.

entityType is not in the same type hierarchy as the entity set's entity type, or keyRow does not have a record result type that matches the key properties of the referenced entity set's entity type.

Applies to