Skip to main content
.NET 6.0+

IXPObject.OnSaving() Method

When implemented by a class, specifies the actions that should be performed before saving the object’s state to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

void OnSaving()

Remarks

If deferred deletion is enabled, this method is also called before deleting the object.

The following code demonstrates how you can implement this method in your class:

public class Customer : XPObject {
    // ...
    DateTime dateModified;
    public DateTime DateModified {
        get { return dateModified;  }
        set { SetPropertyValue<DateTime>(nameof(DateModified), ref dateModified, value); }
    }
    public void SetDateModified() {
        newObject.DateModified = DateTime.Today;
    }
    protected override void OnSaving() {
        base.OnSaving();
        SetDateModified();
    }
}
See Also