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

XAF0014: The property with the Association attribute must have a correct unique pair

Severity: Error

Properties with the Association attribute must have a correct unique pair. Only one property (except itself) with the same association name (or without name if no name provided for property itself) must be declared in type on association end.

#Examples

#Invalid Code

using DevExpress.Xpo;

namespace MyApplication.BusinessObjects { 
    [Persistent]
    public class BusinessTask1 : BaseObject {
        // Property with Association attribute must have pair
        [Association]
        public BusinessTask1 SubTasks { 
            get { ... }
            set { ... } 
        }
    }

    [Persistent]
    public class BusinessTask2 : BaseObject {
        // Property with Association attribute must have unique pair
        [Association]
        public BusinessTask2 ParentTask { 
            get { ... }
            set { ... } 
        }

        // Property with Association attribute must have unique pair
        [Association]
        public BusinessTask2 SubTask { 
            get { ... }
            set { ... } 
        }

        // Property with Association attribute must have unique pair
        [Association]
        public BusinessTask2 SubTask2 { 
            get { ... }
            set { ... } 
        }
    }
}

#Valid Code

using DevExpress.Xpo;

namespace MyApplication.BusinessObjects{
    [Persistent]
    public class BusinessTask : BaseObject {
        [Association]
        public BusinessTask ParentTask { 
            get { ... }
            set { ... } 
        }

        [Association]
        public XPCollection<BusinessTask> SubTasks { 
            get { ... }
        }
    }
}