ConcurrencyControlAttribute
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 ConcurrencyControlAttribute to specify the concurrency control strategy applied to an entity class. Via the Strategy property you could set what should be the concurrency control. Its values are predefined in the ConcurrencyControlStrategy enumeration. Currently you could set the Strategy to one of these values:
- Default - defines that the default value for the optimistic concurrency control strategy will be used by the runtime. The runtime might calculate this value on a later stage depending on the other settings of the meta model or the specific backend used.
- None - defines that no concurrency checks will be done on the database server.
- Version - defines that a version column is used to detect concurrent updates. The version number is incremented on every update and the previous version number is included in the where clause. This is the fastest and safest optimistic concurrency control mode. This is the default and suggested concurrency mode.
- Timestamp - defines that a timestamp column will be used to detect concurrent updates. The timestamp is set on every update and the previous value is included in the where clause. This may not be safe if updates happen quicker than the resolution of the timestamp field. It is included to support legacy database schemas.
- Changed - defines that previous values of all changed columns will be included in the where clause. This provides more fine-grained optimistic concurrency control as different transactions may modify different fields of the same instance. This mode can be used when the database schema allows no modifications (adding a version column for example). Float and double fields are excluded as they are not exact (rounding procedures are different across databases and also differ from the way in which .NET is handling it).
- Backend - defines that a backend specific concurency control mechanism is used.
- All - defines that the values of all columns (changed or not) will be included in the where clause.
[TableAttribute( "Invoice" )]
[ConcurrencyControl( Strategy = OptimisticConcurrencyControlStrategy.Default )]
public class Invoice
{
[Column( "Id" )]
public int Id
{
get;
set;
}
}
<TableAttribute("Invoice"), ConcurrencyControl(Strategy := OptimisticConcurrencyControlStrategy.Default)>
Public Class Invoice
<Column("Id")>
Public Property Id() As Integer
End Class