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

StorageAttribute

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.

Use this attribute to designate a private storage field to hold the value from a column. The StorageAttribute has just one property - NameOfField. The value of the NameOfField property is case sensitive. For example, ensure that the value used for the NameOfField property matches the case for the corresponding property name used elsewhere in the code.

private int orderId;

[Column("Ord_id", IsPrimaryKey = true, IsBackendCalculated = true)]
[Storage("orderId")]
public int OrderId
{
   get { return orderId; }
   set { orderId = value; }
}
Private _orderId As Integer
<Column("Ord_id", IsPrimaryKey := True, IsBackendCalculated := True), Storage("orderId")>
Public Property OrderId() As Integer
 Get
  Return _orderId
 End Get
 Set(ByVal value As Integer)
  _orderId = value
 End Set
End Property

The StorageAttribute is used for relating a property with a private field. The reason behind this is for Telerik Data Access to be able to collect the full metadata about a member of a persistent class. In the previous example, if the StorageAttribute is omitted, then the result will be a table with two columns OrderId and OrderId2. The reason is that Telerik Data Access doesn't know that the property and the field refer to the same member.

If auto-properties are used, then you can avoid specifying StorageAttribute.

[Column("Ord_id", IsPrimaryKey = true, IsBackendCalculated = true)]
public int OrderId
{
   get;
   set;
}
<Column("Ord_id", IsPrimaryKey := True, IsBackendCalculated := True)>
Public Property OrderId() As Integer