Data Access has been discontinued. Please refer to this page for more information.

Obtaining an Object Key

Each persistent type defined in the Telerik Data Access Model has an identity that is made up of one ore more primitive members. Together these members uniquely identify an instance of the persistent type. At runtime you see this represented as an ObjectKey. An ObjectKey instance describes the identity of a persistent type. The ObjectKey plays a critical role in the life cycle of an entity, enabling your application to keep track of an entity, perform database updates, and more. Normally, this in-memory identifier is mapped directly to a primary key column(s) in the database.

The OpenAccessContext exposes several methods for obtaining an persistent object by key. These are: GetObjectByKey, GetObjectByKey<T>, GetObjectsByKeys<T>, TryGetObjectByKey, and TryGetObjectByKey<T>. The reverse operation - obtaining a key by persistent object is also possible. In this case, you could use either CreateObjectKey or CreateObjectKeyWithVersion.

For more information about the ObjectKey API, please refer to the ObjectKey API section.