Back to Devexpress

Session.FlushChanges() Method

xpo-devexpress-dot-xpo-dot-session-e242f044.md

latest3.9 KB
Original Source

Session.FlushChanges() Method

Saves changes made to persistent objects to a data store, and clears a list of tracked changes.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public void FlushChanges()
vb
Public Sub FlushChanges

Remarks

Call this method to save any changes made to persistent objects after the Session.TrackingChanges property has been set to true. To discard changes and clear a list of tracked changes, call the Session.DropChanges method.

When a list of tracked changes is about to be processed, the Session.BeforeFlushChanges event is raised. After a list of tracked changes has been cleared, the Session.AfterFlushChanges event is raised.

Note

Calling the FlushChanges method sets the Session.TrackingChanges property to false. This method is automatically called when a session or unit of work commits a transaction.

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

XAF_generate-a-sequential-number-for-a-persistent-object-within-a-database-transaction/CS/XPO/SequenceGenerator/SequenceGenerator.Module/SequenceClasses/SequenceGenerator.cs#L68

csharp
}
    ExplicitUnitOfWork.FlushChanges();
}

XPO_how-to-generate-a-sequential-number-for-a-business-object-within-a-database-transaction-e2620/CS/ExplicitUnitOfWorkDemo/SequenceGenerator.cs#L34

csharp
seq.NextId++;
    euow.FlushChanges();
} catch(LockingException) {

XPO_how-to-generate-a-sequential-number-for-a-business-object-within-a-database-transaction-e2620/VB/ExplicitUnitOfWorkDemo/SequenceGenerator.vb#L36

vb
seq.NextId += 1
    euow.FlushChanges()
Catch e1 As LockingException

See Also

FlushChangesAsync

CommitChanges()

ExplicitUnitOfWork.CommitTransaction

Session.CommitTransaction

Session Class

Session Members

DevExpress.Xpo Namespace