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

Obtaining an Object Key

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

Each persistent type defined in the Telerik Data Access Domain 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. In the Visual Designer and 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>, 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.