Export (0) Print
Expand All

EntityKey Class

Provides a durable reference to an object that is an instance of an entity type.

System::Object
  System.Data::EntityKey

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

[SerializableAttribute]
[DebuggerDisplayAttribute(L"{ConcatKeyValue()}")]
[DataContractAttribute(IsReference = true)]
public ref class EntityKey sealed : IEquatable<EntityKey^>

The EntityKey type exposes the following members.

  NameDescription
Public methodEntityKey()Initializes a new instance of the EntityKey class.
Public methodEntityKey(String, IEnumerable<KeyValuePair<String, Object>>)Initializes a new instance of the EntityKey class with an entity set name and a generic KeyValuePair collection.
Public methodEntityKey(String, IEnumerable<EntityKeyMember>)Initializes a new instance of the EntityKey class with an entity set name and an IEnumerable<T> collection of EntityKeyMember objects.
Public methodEntityKey(String, String, Object)Initializes a new instance of the EntityKey class with an entity set name and specific entity key pair.
Top

  NameDescription
Public propertyEntityContainerNameGets or sets the name of the entity container.
Public propertyEntityKeyValuesGets or sets the key values associated with this EntityKey.
Public propertyEntitySetNameGets or sets the name of the entity set.
Public propertyIsTemporaryGets a value that indicates whether the EntityKey is temporary.
Top

  NameDescription
Public methodEquals(EntityKey)Returns a value that indicates whether this instance is equal to a specified EntityKey.
Public methodEquals(Object)Returns a value that indicates whether this instance is equal to a specified object. (Overrides Object::Equals(Object).)
Public methodGetEntitySetGets the entity set for this entity key from the given metadata workspace.
Public methodGetHashCodeServes as a hash function for the current EntityKey object. GetHashCode is suitable for hashing algorithms and data structures such as a hash table. (Overrides Object::GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodOnDeserializedHelper method that is used to deserialize an EntityKey.
Public methodOnDeserializingHelper method that is used to deserialize an EntityKey.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public operatorStatic memberEqualityCompares two EntityKey objects.
Public operatorStatic memberInequalityCompares two EntityKey objects.
Top

  NameDescription
Public fieldStatic memberEntityNotValidKeyA simple EntityKey identifying an entity that resulted from a failed TREAT operation.
Public fieldStatic memberNoEntitySetKeyA singleton EntityKey by which a read-only entity is identified.
Top

The EntityKey objects are immutable; that is, after they are constructed they cannot be modified.

For more information, see Working with Entity Keys (Entity Framework).

These examples are based on the Adventure Works Sales Model. The examples show you how to create and use an EntityKey.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.3, 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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft