Back to Devexpress

XAF0016: Descendants of NonPersistentBaseObject and NonPersistentLiteObject must be decorated with the DomainComponent attribute

expressappframework-403921-debugging-testing-and-error-handling-code-diagnostics-xaf0016.md

latest1.6 KB
Original Source

XAF0016: Descendants of NonPersistentBaseObject and NonPersistentLiteObject must be decorated with the DomainComponent attribute

  • May 18, 2022

Severity: Error

XAF requires that the NonPersistentBaseObject and NonPersistentLiteObject descendants must be decorated with the DomainComponentAttribute attribute

Examples

Invalid Code

csharp
using DevExpress.Xpo; 

namespace MySolution.Module.BusinessObjects{ 
    // Descendant of NonPersistentBaseObject must be decorated with the DomainComponentAttribute
    public class NonPersistentBaseObjectWithoutDomainComponent : NonPersistentBaseObject {}

    // Descendant of NonPersistentLiteObject must be decorated with the DomainComponentAttribute
    public class NonPersistentLiteObjectWithoutDomainComponent : NonPersistentLiteObject {}
}

Valid Code

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

namespace MySolution.Module.BusinessObjects {
    [DomainComponent]
    public class NonPersistentBaseObjectWithDomainComponent : NonPersistentBaseObject {}

    [DomainComponent]
    public class NonPersistentLiteObjectWithDomainComponent : NonPersistentLiteObject {}
}

How to Fix

Decorate the NonPersistentBaseObject and NonPersistentLiteObject descendants with the DomainComponentAttribute

See Also

Non-Persistent Objects