Skip to main content
A newer version of this page is available. .

UnitOfWork.CommitChangesAsync(CancellationToken) Method

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll

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. For more information, see Unit of Work.

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:

See Also