Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Concurrency Control Algorithms
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > Concurrency Control > Concurrency Control Algorithms

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

OpenAccess ORM offers two different concurrency control algorithms. Both offer several degrees of isolation; however, they differ in other behavior, giving the application developer the freedom to choose the appropriate degree of isolation and/or scheduling behavior (The actual isolation achieved also depends on the backend and/or its configuration).

Optimistic concurrency control
 

Potential conflicts throughout the concurrent execution of operations are detected late. Basically, at commit time a check is made to see if the objects in the committing transaction have been modified by any other transaction in the meantime.

Optimistic Concurrency control is the default behavior. OpenAccess ORM offers three different optimistic concurrency control modes – version, timestamp and changed. Optimistic concurrency control may also be disabled.

Pessimistic concurrency control
 

Conflicts are detected early. Locking objects to prevent concurrent modifications usually achieves this.

The Concurrency transaction property is used to specify the concurrency algorithm and the desired isolation level. For example, to choose optimistic concurrency control with NO_LOST_UPDATE, the following code is used:

Copy Code
IObjectScope scope = . . . ;

scope.TransactionProperties.Concurrency = TransactionMode.OPTIMISTIC_NO_LOST_UPDATES;

The OpenAccess.TransactionMode enum contains the following values.

 

OPTIMISTIC_NO_LOST_UPDATES

 

PESSIMISTIC_EXPLICIT

 

PESSIMISTIC_WRITE_LOCK_WHEN_FETCHED

The achieved isolation and behavior also depends on the backend used. For example, in case of repeatable read, in some database systems, readers don’t block writers (so-called "versioning" databases) whereas in some other database systems, a reader would block writers.