Session.OptimisticLockingReadBehavior Property
Gets or sets a value which specifies how XPO behaves when reloading changed objects (objects with different versions).
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v18.2.dll
Declaration
[DefaultValue(OptimisticLockingReadBehavior.Default)]
public OptimisticLockingReadBehavior OptimisticLockingReadBehavior { get; set; }
Property Value
Type | Default | Description |
---|---|---|
OptimisticLockingReadBehavior | **Default** | An OptimisticLockingReadBehavior enumeration value that specifies how XPO behaves when reloading changed objects (objects with different versions). |
Available values:
Name | Description |
---|---|
Default | The default behavior can be changed by setting the XpoDefault.OptimisticLockingReadBehavior property. |
Ignore | The changed objects are not reloaded. |
ReloadObject | The changed objects are automatically reloaded. |
Mixed | If a transaction has been started, the changed objects are not reloaded. Otherwise, the changed objects are automatically reloaded. |
ThrowException | An exception is thrown. |
MergeCollisionIgnore | When the client-side and database values of a property are different, the client-side value persists. When field-level tracking is disabled (see Session.TrackPropertiesModifications), this value is treated like Mixed. |
MergeCollisionThrowException | When the client-side and database values of a property are different, an exception is thrown. When field-level tracking is disabled (see Session.TrackPropertiesModifications), this value is treated like the Mixed. |
MergeCollisionReload | When the client-side and database values of a property are different, the database value is reloaded. When field-level tracking is disabled (see Session.TrackPropertiesModifications), this value is treated like Mixed. |
Remarks
XPO v1 automatically reloads changed objects. To determine the change, it reads the database’s OptimisticLock field value which is loaded with each query.
XPO v2 allows automatic object reloading to be disabled. It exposes two properties that control XPO’s behavior in such instances. These properties are: OptimisticLockingReadBehavior and XpoDefault.OptimisticLockingReadBehavior. The default values of these properties provides the same behavior as in XPO v1. Note that the default behavior can be changed later on. Thus, if your code depends upon this behavior, make sure to explicitly specify the desired behavior using the properties mentioned above.