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

XAF0015: Association must not have the Aggregated attribute if it is paired to the "many" end of the association

  • 2 minutes to read

Severity: Warning

Many-to-Many associations must not have Aggregated attribute on any ends. One-to-Many associations must not have Aggregated attribute on “one” ends.

Examples

Invalid Code

using DevExpress.ExpressApp;

namespace MySolution.Module.BusinessObjects { 
    [Persistent]
    public class OneToManyAssociationBothAggregated {
        // One-to-Many association should not have Aggregated attribute on "one" end
        [Association, Aggregated]
        public OneToManyAssociationBothAggregated Parent { 
            get { ... }
            set { ... } 
        }

        [Association, Aggregated]
        public XPCollection<OneToManyAssociationBothAggregated> Children { 
            get { ... } 
        }
    }

    [Persistent]
    public class ManyToManyAssociationBothAggregated {
        // Many-to-Many association should not have Aggregated attribute on any end
        [Association, Aggregated]
        public XPCollection<ManyToManyAssociationBothAggregated> Friends { 
            get { ... }
            set { ... } 
        }

        // Many-to-Many association should not have Aggregated attribute on any end
        [Association, Aggregated]
        public XPCollection<ManyToManyAssociationBothAggregated> Colleagues { 
            get { ... }
            set { ... } 
        }
    }
}

Valid Code

using DevExpress.ExpressApp;

namespace MySolution.Module.BusinessObjects {
    [Persistent]
    public class OneToOneAssociationBothAggregated : BaseObject {
        [Association, Aggregated]
        public OneToOneAssociationBothAggregated PropertyOne { 
            get { ... }
            set { ... } 
        }

        [Association, Aggregated]
        public OneToOneAssociationBothAggregated PropertyTwo { 
            get { ... }
            set { ... } 
        }
    }

    [Persistent]
    public class OneToManyAssociationManyAggregated : BaseObject {
        [Association]
        public OneToManyAssociationManyAggregated Parent { 
            get { ... }
            set { ... } 
        }

        [Association, Aggregated]
        public XPCollection<OneToManyAssociationManyAggregated> Children { 
            get { ... }
        }
    }
}