All docs
V21.2
21.2
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

XAF0003: XPO business classes should be public

Severity: Error

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 { // Error: XAF0003
    //    public ExampleObject1(Session session) : base(session) {}
    //}

    // The class must be public 
    //[DefaultClassOptions]
    //private class ExampleObject2 : BaseObject { // Error: 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.