To track successfully concurrency issues of any kind outside Telerik OpenAccess ORM, we need to accurately track which persistent class and its properties are modified. One way to do it is to have the Id and Version fields of the persistent class exposed publicly so that they can be accessed by customer bossiness logic or bind to UI controls. This is the purpose of the IDataObjectKey interface.
This is a sample that demonstrates how the interface is implemented:
| C# |
Copy Code |
|
[Persistent] class Person : IDataObjectKey { public string DataObjectKey { get { return Telerik.OpenAccess.DataObjectKey.Obtain(this); } } private string name; public string Name { get { return name; } set { name = value; } } } |
| VB.NET |
Copy Code |
|
Imports Telerik.OpenAccess Public Class Class1 End Class <Persistent()> _ Class Person Implements IDataObjectKey Public ReadOnly Property DataObjectKey() As String Implements IDataObjectKey.DataObjectKey Get Return Telerik.OpenAccess.DataObjectKey.Obtain(Me) End Get End Property Private name1 As String Public Property Name() As String Get Return Name End Get Set(ByVal value As String) name1 = value End Set End Property End Class |
 |
This functionality is helpful especially in web UI scenarios where you have a fully disconnected architecture. You can use this interface to preserve to which persistent class the modified data belongs, for example by storing the id and version fields in the viewstate. |