.NET Framework 4.5.2+
.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.v21.2.dll

Declaration

public void BeginTrackingChanges()

Remarks

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 (a database level 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.

Note

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

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

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