.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.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.v20.2.dll

Declaration

void OnSaving()
Sub 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