EntityKey.Equality(EntityKey, EntityKey) EntityKey.Equality(EntityKey, EntityKey) EntityKey.Equality(EntityKey, EntityKey) EntityKey.Equality(EntityKey, EntityKey) Operator

Definition

Compares two EntityKey objects.

public:
 static bool operator ==(System::Data::EntityKey ^ key1, System::Data::EntityKey ^ key2);
public static bool operator == (System.Data.EntityKey key1, System.Data.EntityKey key2);
static member ( = ) : System.Data.EntityKey * System.Data.EntityKey -> bool
Public Shared Operator == (key1 As EntityKey, key2 As EntityKey) As Boolean

Parameters

Returns

true if the key1 and key2 values are equal; otherwise, false.

Remarks

Temporary keys have different comparison semantics than permanent keys:

  • Temporary keys use reference equality. That is, two references to the exact same temporary EntityKey instance are equal but no other EntityKey instances are equal.

  • Permanent keys determine equality based on the values of the contained key properties and the EntitySet. That is, you can have two separate EntityKey instances that are equal if their entity sets are the same and their key values are equal.

In addition, temporary keys have no EntitySet or key values, but permanent keys do.

The equivalent method for this operator is EntityKey.Equals(EntityKey) Method System.Data.Entity 4.0.0.0 System.Boolean A to compare. A to compare.

Compares two objects. if the and values are not equal; otherwise, . <![CDATA[

Temporary keys have different comparison semantics than permanent keys:

  • Temporary keys use reference equality. That is, two references to the exact same temporary EntityKey instance are equal but no other EntityKey instances are equal.

  • Permanent keys determine equality based on the values of the contained key properties and the EntitySet. That is, you can have two separate EntityKey instances that are equal if their entity sets are the same and their key values are equal.

In addition, temporary keys have no EntitySet or key values, but regular keys do.

The equivalent method for this operator is EntityKey.Equals(EntityKey).

Applies to