Saves all the changes made to the persistent objects belonging to the current Object Space to the database.
NuGet Package: DevExpress.ExpressApp
See IObjectSpace.CommitChanges for a code example.
When working with persistent objects, the changes that you make are not saved immediately. Each object change is tracked. To save all the tracked changes, the CommitChanges method is called. This method calls a protected virtual DoCommit method, which must be implemented in the BaseObjectSpace class’ descendants.
In default scenarios, this method is automatically called. But all custom manipulations that you perform with persistent objects must be saved manually via this method.
The following events related to this method are available:
Handle this event to prevent the commit operation performed by the CommitChanges method. For this purpose, set the handler’s CancelEventArgs.Cancel parameter to true.
To perform a custom commit instead of a default one, handle the BaseObjectSpace.CustomCommitChanges event. Set the HandledEventArgs.Handled property to true to indicate that the commit operation has been already performed.
To perform custom actions after committing object changes, handle the BaseObjectSpace.Committed event.
An Object Space is supposed to commit only the objects that were created with its help. Otherwise, an exception must be raised. This must be implemented in the protected virtual CheckLocking method of the BaseObjectSpace class’s descendants.