Back to Devexpress

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

expressappframework-404162-debugging-testing-and-error-handling-code-diagnostics-xaf0025.md

latest1.6 KB
Original Source

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

  • Nov 14, 2022

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 ClassReplacement
DevExpress.Xpo.KeyAttributeDevExpress.ExpressApp.Data.KeyAttribute
DevExpress.Xpo.SizeAttributeDevExpress.ExpressApp.DC.FieldSizeAttribute
DevExpress.Xpo.DisplayNameAttributeDevExpress.ExpressApp.DC.XafDisplayNameAttribute
DevExpress.Xpo.CustomAttributeDevExpress.ExpressApp.Model.ModelDefaultAttribute
DevExpress.Xpo.MemberDesignTimeVisibilityAttributeSystem.ComponentModel.BrowsableAttribute
DevExpress.Xpo.PersistentAliasAttributeDevExpress.ExpressApp.DC.CalculatedAttribute

Examples

Invalid Code

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

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

Valid Code

csharp
using DevExpress.ExpressApp.DC;

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