Skip to main content
All docs
V24.1
.NET 6.0+

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 { ... }
        }
    }
}