internal AssociationSetMetadata(IEnumerable <AssociationEndMember> requiredEnds) { if (requiredEnds.Any <AssociationEndMember>()) { this.RequiredEnds = new Set <AssociationEndMember>(requiredEnds); } AssociationSetMetadata.FixSet(ref this.RequiredEnds); AssociationSetMetadata.FixSet(ref this.OptionalEnds); AssociationSetMetadata.FixSet(ref this.IncludedValueEnds); }
internal AssociationSetMetadata( Set <EntitySet> affectedTables, AssociationSet associationSet, MetadataWorkspace workspace) { bool flag = 1 < affectedTables.Count; ReadOnlyMetadataCollection <AssociationSetEnd> associationSetEnds = associationSet.AssociationSetEnds; foreach (EntitySet affectedTable in affectedTables) { foreach (EntitySet entitySet in MetadataHelper.GetInfluencingEntitySetsForTable(affectedTable, workspace)) { foreach (AssociationSetEnd associationSetEnd in associationSetEnds) { if (associationSetEnd.EntitySet.EdmEquals((MetadataItem)entitySet)) { if (flag) { AssociationSetMetadata.AddEnd(ref this.RequiredEnds, associationSetEnd.CorrespondingAssociationEndMember); } else if (this.RequiredEnds == null || !this.RequiredEnds.Contains(associationSetEnd.CorrespondingAssociationEndMember)) { AssociationSetMetadata.AddEnd(ref this.OptionalEnds, associationSetEnd.CorrespondingAssociationEndMember); } } } } } AssociationSetMetadata.FixSet(ref this.RequiredEnds); AssociationSetMetadata.FixSet(ref this.OptionalEnds); foreach (ReferentialConstraint referentialConstraint in associationSet.ElementType.ReferentialConstraints) { AssociationEndMember fromRole = (AssociationEndMember)referentialConstraint.FromRole; if (!this.RequiredEnds.Contains(fromRole) && !this.OptionalEnds.Contains(fromRole)) { AssociationSetMetadata.AddEnd(ref this.IncludedValueEnds, fromRole); } } AssociationSetMetadata.FixSet(ref this.IncludedValueEnds); }