Skip to main content
All docs
V24.2
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XAF0024: Do not implement IXafEntityObject in the XPO classes

Severity: Warning

Do not implement the IXafEntityObject interface in an XPO class. Instead, override the AfterConstruction, OnLoaded, and OnSaving methods, or handle events of IObjectSpace/XAF CRUD Controllers.

#Examples

#Invalid Code

using DevExpress.ExpressApp;
using DevExpress.Xpo;

namespace TestApplication.Module.BusinessObjects {
    // Do not implement IXafEntityObject in the XPO classes
    public class BaseObject1 : BaseObject, IXafEntityObject {
        public BaseObject1(Session session) : base() {}

        public override void AfterConstruction() {
            base.AfterConstruction();
            // ...
        }
        protected override void OnLoaded() {
            base.OnLoaded();
            // ...
        }

        protected override void OnSaving() {
            base.OnSaving();
            // ...
        }
    }
}

#Valid Code

using DevExpress.ExpressApp;
using DevExpress.Xpo;

namespace TestApplication.Module.BusinessObjects {
    public class BaseObject1 : BaseObject {
        public BaseObject1(Session session) : base() {}

        public override void AfterConstruction() {
            base.AfterConstruction();
            // ...
        }
        protected override void OnLoaded() {
            base.OnLoaded();
            // ...
        }

        protected override void OnSaving() {
            base.OnSaving();
            // ...
        }
    }
}