Skip to main content
.NET 8.0+

UnitOfWork.CommitChanges() Method

Commits all the changes made to persistent objects to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public void CommitChanges()

Remarks

A Unit of Work tracks every change to every persistent object during a transaction that can affect a data store. Its CommitChanges method commits all the changes made to persistent objects to a data store. The only requirement for this is that the property setters call the XPBaseObject.OnChanged method.

Calling the CommitChanges method automatically calls Session.CommitTransaction (in explicit units of work, ExplicitUnitOfWork.CommitTransaction is called).

Note

If a save operation fails (for example, due to a database constraint violation), the following exceptions can be raised by XPO:

The following code snippets (auto-collected from DevExpress Examples) contain references to the CommitChanges() 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