Export (0) Print
Expand All

EntityKey.Equality Operator

Compares two EntityKey objects.

Namespace:  System.Data
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static bool operator ==(
	EntityKey key1,
	EntityKey key2
)

Parameters

key1
Type: System.Data.EntityKey

A EntityKey to compare.

key2
Type: System.Data.EntityKey

A EntityKey to compare.

Return Value

Type: System.Boolean
true if the key1 and key2 values are equal; otherwise, false.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft