Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RelationshipGroupEnd"/> class.
        /// </summary>
        /// <param name="associationSet">The association set.</param>
        /// <param name="associationSetEnd">The association set end.</param>
        public RelationshipGroupEnd(AssociationSet associationSet, AssociationSetEnd associationSetEnd)
        {
            this.EntitySet    = associationSetEnd.EntitySet;
            this.EntityType   = associationSetEnd.AssociationEnd.EntityType;
            this.Multiplicity = associationSet.GetOtherEnd(associationSetEnd).AssociationEnd.Multiplicity;

            this.associationSetEnds = new List <KeyValuePair <AssociationSet, AssociationSetEnd> >();
            this.associationSetEnds.Add(new KeyValuePair <AssociationSet, AssociationSetEnd>(associationSet, associationSetEnd));
            this.Candidates = new List <RelationshipCandidate>();

            this.CapacitySelector = CapacityRangeSelector.GetDefaultCapacityRangeSelector(this.Multiplicity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RelationshipGroupEnd"/> class.
        /// </summary>
        /// <param name="associationSetAndEndPairs">The association set and end pairs.</param>
        public RelationshipGroupEnd(IEnumerable <KeyValuePair <AssociationSet, AssociationSetEnd> > associationSetAndEndPairs)
        {
            var entitySets = associationSetAndEndPairs.Select(p => p.Value.EntitySet).Distinct();

            ExceptionUtilities.Assert(entitySets.Count() == 1, "All AssociationSetEnds should have the same EntitySet");

            var entityTypes = associationSetAndEndPairs.Select(p => p.Value.AssociationEnd.EntityType).Distinct();

            ExceptionUtilities.Assert(entityTypes.Count() == 1, "All AssociationSetEnds should have the same EntityType");

            this.EntitySet  = entitySets.Single();
            this.EntityType = entityTypes.Single();

            this.Multiplicity = EndMultiplicity.One;

            this.associationSetEnds = new List <KeyValuePair <AssociationSet, AssociationSetEnd> >();
            this.associationSetEnds.AddRange(associationSetAndEndPairs);
            this.Candidates = new List <RelationshipCandidate>();

            this.CapacitySelector = CapacityRangeSelector.GetDefaultCapacityRangeSelector(this.Multiplicity);
        }