Skip to main content
All docs
V24.2
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.