Back to Devexpress

XPClassInfo.TrackPropertiesModifications Property

xpo-devexpress-dot-xpo-dot-metadata-dot-xpclassinfo-bab8323f.md

latest3.2 KB
Original Source

XPClassInfo.TrackPropertiesModifications Property

Specifies whether or not the persistent object properties modifications are tracked.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public bool? TrackPropertiesModifications { get; }
vb
Public ReadOnly Property TrackPropertiesModifications As Boolean?

Property Value

TypeDescription
Nullable<Boolean>

true , if the persistent objects’ properties modifications are tracked; otherwise, false.

|

Remarks

When the TrackPropertiesModifications is set to true , field-level optimistic locking is enabled. Its behavior can be configured via the OptimisticLockingAttribute attribute and the Session.OptimisticLockingReadBehavior property.

You can enable/disable property tracking for each persistent type individually by applying the OptimisticLockingReadBehaviorAttribute attribute. This attribute overrides the TrackPropertiesModifications setting of the Session. To disable optimistic locking for a specific persistent property, apply the OptimisticLockingIgnoredAttribute to this property.

Properties Implementation Requirements

To support this functionality, persistent properties should be implemented in a specific manner. If you implement your business model in code, use either the SetPropertyValue or OnChanged method in persistent property setters. These methods have several overloads. Use the overloads that take both the old and new property values:

csharp
SetPropertyValue(nameof(PropertyName), ref propertyValueHolder, value);
vb
SetPropertyValue(NameOf(PropertyName), propertyValueHolder, value)
csharp
OnChanged(nameof(PropertyName), propertyValueHolder, value);
vb
OnChanged(NameOf(PropertyName), propertyValueHolder, value)

If you use the Data Model Designer to create the data model, then you do not need to worry about implementing persistent properties. Designer automatically declares persistent properties in the proper manner.

See Also

XPClassInfo Class

XPClassInfo Members

DevExpress.Xpo.Metadata Namespace