Skip to main content
.NET 8.0+

IObjectSpace.ConfirmationRequired Event

Occurs when performing refresh or rollback operations with the current Object Space’s persistent objects.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

event EventHandler<ConfirmationEventArgs> ConfirmationRequired

Event Data

The ConfirmationRequired event's data class is DevExpress.ExpressApp.ConfirmationEventArgs.

Remarks

The ConfirmationRequired event is raised as a result of reloading or rolling back. Handle this event to invoke a confirmation window of the type specified as the handler’s ConfirmationEventArgs.ConfirmationType parameter. For this purpose, use the XafApplication.AskConfirmation method. It will show the required window with three buttons: Yes, No and Cancel. The end-user’s selection will be returned as the ConfirmationResult enumeration value. Set this value to the handler’s ConfirmationEventArgs.ConfirmationResult parameter. This will specify the remaining actions to be made in the method which raised this event.

The following code demonstrates how to handle the ConfirmationRequired event via a View Controller:

public class MyViewController : ViewController {
   private void ObjectSpace_ConfirmationRequired(object sender, ConfirmationEventArgs e) {
      e.ConfirmationResult = Application.AskConfirmation(e.ConfirmationType);
   }
   private void MyViewController_Activated(object sender, EventArgs e) {
      View.ObjectSpace.ConfirmationRequired += 
         new EventHandler<ConfirmationEventArgs>(ObjectSpace_ConfirmationRequired);
   }
}

The ConfirmationRequired event is already handled by the WinModificationsController, activated for Detail Views in Windows Forms applications only. This Controller’s handler invokes a confirmation window as described above. When the ConfirmationRequired method is invoked within a List View, or in an ASP.NET Web Forms application, a confirmation window is not invoked. You can change this behavior by handling the ConfirmationRequired event.

If you implement the IObjectSpace interface in the BaseObjectSpace class’ descendant, you won’t have to raise this event, because the BaseObjectSpace.Refresh and BaseObjectSpace.Rollback methods raise it. Instead, you will have to override a protected virtual BaseObjectSpace.Reload method only. It is a virtual method that is invoked by the BaseObjectSpace.Refresh and BaseObjectSpace.Rollback methods when it is required to reload the container for in-memory objects (XPObjectSpace.Session in case of the XPObjectSpace, or EFCoreObjectSpace.DbContext in case of the EFCoreObjectSpace).

See Also