.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.TrackPropertiesModifications Property

Specifies whether or not the current Session tracks persistent object property modifications.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.2.dll

Declaration

[DefaultValue(false)]
public bool TrackPropertiesModifications { get; set; }

Property Value

Type Default Description
Boolean

false

true, if the Session tracks persistent object property modifications; otherwise, false.

Remarks

The default value of the TrackPropertiesModifications property is taken from the static XpoDefault.TrackPropertiesModifications property.

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:

SetPropertyValue(nameof(PropertyName), ref propertyValueHolder, value);
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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TrackPropertiesModifications property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also