XAF0019: Apply ExplicitLoadingAttribute only to reference properties
Severity: Warning
XPO requires the ExplicitLoadingAttribute attribute be applied only to reference properties whose return type is a PersistentBase descendant. Applying this attribute to non-reference properties and fields has no effect.
Examples
Invalid Code
using DevExpress.Xpo;
namespace TestApplication.Module.BusinessObjects {
public class TestClass : PersistentBase {
public TestClass(Session session)
: base(session) {
}
private string fTopic;
// The ExplicitLoading attribute is applied to a non-reference property
[ExplicitLoading] // Warning
public string Topic {
get { return fTopic; }
set { SetPropertyValue(nameof(Topic), ref fTopic, value); }
}
}
}
Valid Code
using DevExpress.Xpo;
namespace TestApplication.Module.BusinessObjects {
public class InnerClass : PersistentBase {
public InnerClass(Session session)
: base(session) {
}
}
public class TestClass : PersistentBase {
public TestClass(Session session)
: base(session) {
}
private InnerClass fTopic;
// This code meets the requirements
[ExplicitLoading]
public InnerClass Topic {
get { return fTopic; }
set { SetPropertyValue(nameof(Topic), ref fTopic, value); }
}
}
}
How To Fix
Remove the ExplicitLoadingAttribute attribute from non-reference properties and fields.