Skip to main content
.NET 6.0+

UnitOfWork.CommitChangesAsync(CancellationToken) Method

Asynchronously commits object changes made in a specified session and notifies upon completion.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public Task CommitChangesAsync(
    CancellationToken cancellationToken = default(CancellationToken)
)

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:

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.

See Also