DbExpressionBuilder.CreateRef Method

Definition

Creates a new DbRefExpression that encodes a reference to a specific entity of a given type based on key values.

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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ CreateRef(System::Data::Metadata::Edm::EntitySet ^ entitySet, System::Collections::Generic::IEnumerable<System::Data::Common::CommandTrees::DbExpression ^> ^ keyValues);
public static System.Data.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Metadata.Edm.EntitySet entitySet, System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> keyValues);
static member CreateRef : System.Data.Metadata.Edm.EntitySet * seq<System.Data.Common.CommandTrees.DbExpression> -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function CreateRef (entitySet As EntitySet, keyValues As IEnumerable(Of DbExpression)) As 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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ CreateRef(System::Data::Metadata::Edm::EntitySet ^ entitySet, ... cli::array <System::Data::Common::CommandTrees::DbExpression ^> ^ keyValues);
public static System.Data.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Metadata.Edm.EntitySet entitySet, params System.Data.Common.CommandTrees.DbExpression[] keyValues);
static member CreateRef : System.Data.Metadata.Edm.EntitySet * System.Data.Common.CommandTrees.DbExpression[] -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function CreateRef (entitySet As EntitySet, ParamArray keyValues As DbExpression()) As 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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ CreateRef(System::Data::Metadata::Edm::EntitySet ^ entitySet, System::Data::Metadata::Edm::EntityType ^ entityType, System::Collections::Generic::IEnumerable<System::Data::Common::CommandTrees::DbExpression ^> ^ keyValues);
public static System.Data.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Metadata.Edm.EntitySet entitySet, System.Data.Metadata.Edm.EntityType entityType, System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> keyValues);
static member CreateRef : System.Data.Metadata.Edm.EntitySet * System.Data.Metadata.Edm.EntityType * seq<System.Data.Common.CommandTrees.DbExpression> -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function CreateRef (entitySet As EntitySet, entityType As EntityType, keyValues As IEnumerable(Of DbExpression)) As 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.

entityType is not from the same type hierarchy (a subtype, supertype, or the same type) as entitySet's element type.

-or-

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:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbRefExpression ^ CreateRef(System::Data::Metadata::Edm::EntitySet ^ entitySet, System::Data::Metadata::Edm::EntityType ^ entityType, ... cli::array <System::Data::Common::CommandTrees::DbExpression ^> ^ keyValues);
public static System.Data.Common.CommandTrees.DbRefExpression CreateRef (this System.Data.Metadata.Edm.EntitySet entitySet, System.Data.Metadata.Edm.EntityType entityType, params System.Data.Common.CommandTrees.DbExpression[] keyValues);
static member CreateRef : System.Data.Metadata.Edm.EntitySet * System.Data.Metadata.Edm.EntityType * System.Data.Common.CommandTrees.DbExpression[] -> System.Data.Common.CommandTrees.DbRefExpression
<Extension()>
Public Function CreateRef (entitySet As EntitySet, entityType As EntityType, ParamArray keyValues As DbExpression()) As 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.

entityType is not from the same type hierarchy (a subtype, supertype, or the same type) as entitySet's element type.

-or-

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