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

Session.BeginTrackingChanges() Method

Enables tracking changes made to persistent objects.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.2.dll


public void BeginTrackingChanges()
Public Sub BeginTrackingChanges


Units of work (ExplicitUnitOfWork and UnitOfWork) automatically track changes made to persistent objects within their scope. In sessions, you need to call the BeginTrackingChanges method to enable tracking changes. To determine if changes are currently being tracked in a session, use the Session.TrackingChanges property.

Calling the BeginTrackingChanges method automatically starts a transaction (an explicit transaction in an explicit unit of work) and raises the Session.BeforeBeginTrackingChanges and Session.AfterBeginTrackingChanges events, allowing you to monitor progress.

To manage changes made in a session or unit of work, use the Session.FlushChanges, Session.FlushChangesAsync, and Session.DropChanges methods.


If the Session.TrackingChanges property returns true, calling the BeginTrackingChanges method throws an exception.

See Also