Επεξεργασία

Κοινή χρήση μέσω


DbExpressionBuilder.RefFromKey Method

Definition

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

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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ RefFromKey(System::Data::Metadata::Edm::EntitySet ^ entitySet, System::Data::Common::CommandTrees::DbExpression ^ keyRow);
public static System.Data.Common.CommandTrees.DbRefExpression RefFromKey (this System.Data.Metadata.Edm.EntitySet entitySet, System.Data.Common.CommandTrees.DbExpression keyRow);
static member RefFromKey : System.Data.Metadata.Edm.EntitySet * System.Data.Common.CommandTrees.DbExpression -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function RefFromKey (entitySet As EntitySet, keyRow As DbExpression) As 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.

Remarks

keyRow should be an expression that specifies the key values that identify the referenced entity within the given entity set. The result type of keyRow should contain a corresponding column for each key property defined by entitySet'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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ RefFromKey(System::Data::Metadata::Edm::EntitySet ^ entitySet, System::Data::Common::CommandTrees::DbExpression ^ keyRow, System::Data::Metadata::Edm::EntityType ^ entityType);
public static System.Data.Common.CommandTrees.DbRefExpression RefFromKey (this System.Data.Metadata.Edm.EntitySet entitySet, System.Data.Common.CommandTrees.DbExpression keyRow, System.Data.Metadata.Edm.EntityType entityType);
static member RefFromKey : System.Data.Metadata.Edm.EntitySet * System.Data.Common.CommandTrees.DbExpression * System.Data.Metadata.Edm.EntityType -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function RefFromKey (entitySet As EntitySet, keyRow As DbExpression, entityType As EntityType) As 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.

Remarks

keyRow should be an expression that specifies the key values that identify the referenced entity within the given entity set. The result type of keyRow should contain a corresponding column for each key property defined by entitySet's entity type.

Applies to