DbExpressionBuilder.RefFromKey 方法

定义

创建新的 DbRefExpression,它按照键值对特定实体的引用进行编码。Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

重载

RefFromKey(EntitySet, DbExpression)

创建新的 DbRefExpression,它按照键值对特定实体的引用进行编码。Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

RefFromKey(EntitySet, DbExpression, EntityType)

创建新的 DbRefExpression,它按照键值对特定实体的引用进行编码。Creates a new DbRefExpression that encodes a reference to a specific Entity based on key values.

RefFromKey(EntitySet, DbExpression)

创建新的 DbRefExpression,它按照键值对特定实体的引用进行编码。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

参数

entitySet
EntitySet

引用元素所在的“实体”。The Entity set in which the referenced element resides.

keyRow
DbExpression

一个 DbExpression,构造具有与实体类型所引用键属性相匹配(编号、类型和顺序)的列的记录。A DbExpression that constructs a record with columns that match (in number, type, and order) the Key properties of the referenced Entity type.

返回

DbRefExpression

使用指定实体集中的指定键值引用元素的新 DbRefExpression。A new DbRefExpression that references the element with the specified key values in the given Entity set.

例外

entitySetkeyRow 为 null。entitySet or keyRow is null.

keyRow 没有与引用的实体集的实体类别匹配的记录结果类型。keyRow does not have a record result type that matches the key properties of the referenced entity set's entity type.

注解

keyRow 应为一个表达式,该表达式指定标识给定实体集中的被引用实体的键值。keyRow should be an expression that specifies the key values that identify the referenced entity within the given entity set. 的结果类型 keyRow 应包含实体类型定义的每个键属性对应的列 entitySet'sThe result type of keyRow should contain a corresponding column for each key property defined by entitySet's entity type.

适用于

RefFromKey(EntitySet, DbExpression, EntityType)

创建新的 DbRefExpression,它按照键值对特定实体的引用进行编码。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

参数

entitySet
EntitySet

引用元素所在的“实体”。The Entity set in which the referenced element resides.

keyRow
DbExpression

一个 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.

返回

DbRefExpression

使用指定实体集中的指定键值引用元素的新 DbRefExpression。A new DbRefExpression that references the element with the specified key values in the given Entity set.

例外

entitySetkeyRowentityType 为 null。entitySet, keyRow or entityType is null.

entityType 与实体集的实体类型不在同一类型层次结构中,或者 keyRow 没有与引用的实体集的实体类型匹配的记录结果类型。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.

注解

keyRow 应为一个表达式,该表达式指定标识给定实体集中的被引用实体的键值。keyRow should be an expression that specifies the key values that identify the referenced entity within the given entity set. 的结果类型 keyRow 应包含实体类型定义的每个键属性对应的列 entitySet'sThe result type of keyRow should contain a corresponding column for each key property defined by entitySet's entity type.

适用于