DbExpressionBuilder.CreateRef Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateRef(EntitySet, IEnumerable<DbExpression>) |
Creates a new DbRefExpression that encodes a reference to a specific entity based on key values. |
CreateRef(EntitySet, DbExpression[]) |
Creates a new DbRefExpression that encodes a reference to a specific entity based on key values. |
CreateRef(EntitySet, EntityType, IEnumerable<DbExpression>) |
Creates a new DbRefExpression that encodes a reference to a specific entity of a given type based on key values. |
CreateRef(EntitySet, EntityType, DbExpression[]) |
Creates a new DbRefExpression that encodes a reference to a specific entity of a given type based on key values. |
CreateRef(EntitySet, IEnumerable<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 CreateRef (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, System.Collections.Generic.IEnumerable<System.Data.Entity.Core.Common.CommandTrees.DbExpression> keyValues);
static member CreateRef : System.Data.Entity.Core.Metadata.Edm.EntitySet * seq<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.
- keyValues
- IEnumerable<DbExpression>
A collection of DbExpressions that provide the key values. These expressions must 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 is null, or keyValues is null or contains null.
The count of keyValues does not match the count of key members declared by the entitySet’s element type, or keyValues contains an expression with a result type that is not compatible with the type of the corresponding key member.
Applies to
CreateRef(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 CreateRef (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, params System.Data.Entity.Core.Common.CommandTrees.DbExpression[] keyValues);
static member CreateRef : 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.
- keyValues
- DbExpression[]
A collection of DbExpressions that provide the key values. These expressions must 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 is null, or keyValues is null or contains null.
The count of keyValues does not match the count of key members declared by the entitySet’s element type, or keyValues contains an expression with a result type that is not compatible with the type of the corresponding key member.
Applies to
CreateRef(EntitySet, EntityType, IEnumerable<DbExpression>)
Creates a new DbRefExpression that encodes a reference to a specific entity of a given type based on key values.
public static System.Data.Entity.Core.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, System.Data.Entity.Core.Metadata.Edm.EntityType entityType, System.Collections.Generic.IEnumerable<System.Data.Entity.Core.Common.CommandTrees.DbExpression> keyValues);
static member CreateRef : System.Data.Entity.Core.Metadata.Edm.EntitySet * System.Data.Entity.Core.Metadata.Edm.EntityType * seq<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.
- entityType
- EntityType
The specific type of the referenced entity. This must be an entity type from the same hierarchy as the entity set's element type.
- keyValues
- IEnumerable<DbExpression>
A collection of DbExpressions that provide the key values. These expressions must 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 entityType is null, or keyValues is null or contains null.
The count of keyValues does not match the count of key members declared by the entitySet’s element type, or keyValues contains an expression with a result type that is not compatible with the type of the corresponding key member.
Applies to
CreateRef(EntitySet, EntityType, DbExpression[])
Creates a new DbRefExpression that encodes a reference to a specific entity of a given type based on key values.
public static System.Data.Entity.Core.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Entity.Core.Metadata.Edm.EntitySet entitySet, System.Data.Entity.Core.Metadata.Edm.EntityType entityType, params System.Data.Entity.Core.Common.CommandTrees.DbExpression[] keyValues);
static member CreateRef : System.Data.Entity.Core.Metadata.Edm.EntitySet * System.Data.Entity.Core.Metadata.Edm.EntityType * 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.
- entityType
- EntityType
The specific type of the referenced entity. This must be an entity type from the same hierarchy as the entity set's element type.
- keyValues
- DbExpression[]
A collection of DbExpressions that provide the key values. These expressions must 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 entityType is null, or keyValues is null or contains null.
The count of keyValues does not match the count of key members declared by the entitySet’s element type, or keyValues contains an expression with a result type that is not compatible with the type of the corresponding key member.
Applies to
Entity Framework