Skip to main content
All docs
V23.2
.NET 6.0+

XAF0025: Use the corresponding XAF ORM-agnostic or Entity Framework attribute

Severity: Warning

Attributes from the DevExpress.Xpo namespace must not be applied to non-persistent or Entity Framework classes or their properties. Use XAF ORM-agnostic attributes or attributes specific to the target data access technology instead.

Consider the following popular replacements for XPO attributes in non-persistent or Entity Framework classes:

XPO Class Replacement
DevExpress.Xpo.KeyAttribute DevExpress.ExpressApp.Data.KeyAttribute
DevExpress.Xpo.SizeAttribute DevExpress.ExpressApp.DC.FieldSizeAttribute
DevExpress.Xpo.DisplayNameAttribute DevExpress.ExpressApp.DC.XafDisplayNameAttribute
DevExpress.Xpo.CustomAttribute DevExpress.ExpressApp.Model.ModelDefaultAttribute
DevExpress.Xpo.MemberDesignTimeVisibilityAttribute System.ComponentModel.BrowsableAttribute
DevExpress.Xpo.PersistentAliasAttribute DevExpress.ExpressApp.DC.CalculatedAttribute

Examples

Invalid Code

using DevExpress.Xpo;
using DevExpress.ExpressApp.DC;

namespace TestApplication.Module.BusinessObjects {
    [DomainComponent]
    public class TestClass {
        [NonPersistent]
        public string Name { get; set; }
    }
}

Valid Code

using DevExpress.ExpressApp.DC;

namespace TestApplication.Module.BusinessObjects {
    [DomainComponent]
    public class TestClass {
        public string Name { get; set; }
    }
}