Skip to main content
All docs
V24.1
.NET 6.0+

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();
            // ...
        }
    }
}