Back to Devexpress

XAF0028: Use the corresponding XPO attribute

expressappframework-404165-debugging-testing-and-error-handling-code-diagnostics-xaf0028.md

latest1.3 KB
Original Source

XAF0028: Use the corresponding XPO attribute

  • Nov 14, 2022

Severity: Warning

Do not decorate members of an XPO class with attributes from the DevExpress.ExpressApp.DC namespace. These attributes are intended to be used with non-persistent classes only. Use corresponding XPO attributes instead.

Consider the following popular replacements for XAF ORM-agnostic attributes in XPO classes:

AttributeReplacement
DevExpress.ExpressApp.Data.KeyAttributeDevExpress.Xpo.KeyAttribute
DevExpress.ExpressApp.DC.FieldSizeAttributeDevExpress.Xpo.SizeAttribute
DevExpress.ExpressApp.DC.AggregatedAttributeDevExpress.Xpo.AggregatedAttribute
DevExpress.ExpressApp.DC.CalculatedAttributeDevExpress.Xpo.PersistentAliasAttribute

Examples

Invalid Code

csharp
using DevExpress.Xpo;

namespace TestApplication.Module.BusinessObjects {
    public class TestClass : XPObject {
        [DevExpress.ExpressApp.DC.FieldSize(1000)]
        public string Description { get; set; }
    }
}

Valid Code

csharp
using DevExpress.Xpo;

namespace TestApplication.Module.BusinessObjects {
    public class TestClass : XPObject {
        public TestClass(Session session) : base(session) { }
        [Size(1000)]
        public string Description { get; set; }
    }
}