UnitOfWork.CommitChangesAsync(CancellationToken) Method
Asynchronously commits object changes made in a specified session and notifies upon completion.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellationToken | CancellationToken | null | A CancellationToken object that delivers a cancellation notice to the running operation. |
Returns
Type | Description |
---|---|
Task | A Task that commits specified object changes. |
Remarks
A Unit of Work tracks every change to every persistent object during a transaction that can affect a data store. Its CommitChangesAsync method commits all object changes to a data store. The only requirement for this is that the property setters call the XPBaseObject.OnChanged method.
Calling the CommitChangesAsync 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 XPO can raise the following exceptions:
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CommitChangesAsync(CancellationToken) 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.