Skip to main content

BaseObjectSpace.Rollback(Boolean) Method

Discards all unsaved changes made by users and invalidates previously loaded objects in the current Object Space.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v25.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public bool Rollback(
    bool askConfirmation = true
)

Optional Parameters

Name Type Default Description
askConfirmation Boolean True

true, if the confirmation dialog is required, otherwise, false.

Returns

Type Description
Boolean

true, if changes made to persistent objects were canceled; otherwise, false.

Remarks

Use this method to cancel changes to persistent objects in the current Object Space. The built-in ModificationsController.CancelAction uses this method.

The Rollback method discards changes made by users to objects loaded by the current Object Space. If there are unsaved changes and the askConfirmation parameter is true (default), it raises the ConfirmationRequired event, and the handler’s ConfirmationResult determines what happens next:

  • Yes – The changes are discarded and objects reloaded
  • No – Rollback operation is aborted

Internally, the Rollback method behaves similarly to the Refresh method, with the key difference being that Rollback only offers Yes/No confirmation options (no Cancel option), and includes the askConfirmation parameter to control whether confirmation is requested.

If you call the Rollback method without parameters, the method prompts the following dialog:

RefreshAskConfirmation

To roll back an Object Space without a confirmation dialog, set the askConfirmation parameter to false.

The following events related to the Rollback method are available:

  • BaseObjectSpace.RollingBack

    Handle this event to stop the Rollback method from rolling back. Set the handler’s CancelEventArgs.Cancel parameter to true.

  • BaseObjectSpace.CustomRollBack

    Handle this event to perform a custom rollback instead of the default one. Set the handler’s CompletedEventArgs.Handled parameter to true to show that you already performed the rollback operation. Set the handler’s CompletedEventArgs.IsCompleted parameter to the value that the Rollback method returns.

Implements

See Also