Skip to main content
All docs
V24.1
.NET Framework 4.5.2+

XAF0003: XPO business classes should be public

Severity: Warning

XAF requires that the XPO business object’s class should be public. Otherwise, it is not recognized as a business object.

This diagnostic works only for XPO classes derived from the DevExpress.Xpo.PersistentBase class. This diagnostics does not work for abstract classes.

Examples

Invalid Code

using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;

namespace MySolution.Module.BusinessObjects{
    // The class must be public
    //[DefaultClassOptions]
    //class ExampleObject1 : BaseObject { // Warning: XAF0003
    //    public ExampleObject1(Session session) : base(session) {}
    //}

    // The class must be public 
    //[DefaultClassOptions]
    //private class ExampleObject2 : BaseObject { // Warning: XAF0003
    //    public ExampleObject1(Session session) : base(session) {}
    //}
// ...
}

Valid Code

using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;

namespace MySolution.Module.BusinessObjects{
    // This class meets the requirements
    [DefaultClassOptions]
    public class ExampleObject1 : BaseObject {
        public ExampleObject1(Session session) : base(session) {}
        // ...
    }
}

How to Fix

Declare the business object’s class with the public keyword.