BaseObjectSpace.SetModified(Object) Method

Sets the state of the specified object to be Modified.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.1.dll

Syntax

public void SetModified(
    object obj
)

Parameters

Type Name Description
Object obj

A persistent object whose state is the subject to be Modified.

Generally, the changes made to persistent object properties are tracked, to then be committed (see BaseObjectSpace.CommitChanges). For the object changes that cannot be tracked internally, use the SetModified method. This method calls a protected virtual SetModified method, which must be implemented in the BaseObjectSpace class' descendants.

The following code demonstrates how the MyViewController's Delete Action removes the selected objects in nested List Views:

public partial class MyViewController : ViewController {
   //...
   private void MyViewController_AfterConstruction(object sender, EventArgs e) {
      this.deleteAction.TargetViewNesting = DevExpress.ExpressApp.Nesting.Nested;
      this.deleteAction.TargetViewType = DevExpress.ExpressApp.ViewType.ListView;
   }
   private void deleteAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
      foreach(object obj in View.SelectedObjects) {
         (View as ListView).CollectionSource.Remove(obj);
         (View as ListView).CollectionSource.ObjectSpace.SetModified(obj);
      }
   }
}

When executing the Delete Action demonstrated above, the selected objects will be marked as objects to be deleted and the nested List View's editor will be refreshed. Since nested List Views are created in the parent Detail View's Object Space, the deleted objects will actually be removed when executing the Detail View's Save or SaveAndClose Action.

Implements