private void PopulateKeyConstraintsForRelationshipSet( SchemaConstraints <BasicKeyConstraint> constraints) { AssociationSet extent = this.m_cellQuery.Extent as AssociationSet; Set <MemberPath> set = new Set <MemberPath>(MemberPath.EqualityComparer); bool flag = false; foreach (AssociationSetEnd associationSetEnd in extent.AssociationSetEnds) { AssociationEndMember associationEndMember = associationSetEnd.CorrespondingAssociationEndMember; List <ExtentKey> keysForEntityType = ExtentKey.GetKeysForEntityType(new MemberPath((EntitySetBase)extent, (EdmMember)associationEndMember), associationSetEnd.EntitySet.ElementType); if (MetadataHelper.DoesEndFormKey(extent, associationEndMember)) { this.AddKeyConstraints((IEnumerable <ExtentKey>)keysForEntityType, constraints); flag = true; } set.AddRange(keysForEntityType[0].KeyFields); } if (flag) { return; } this.AddKeyConstraints((IEnumerable <ExtentKey>) new ExtentKey[1] { new ExtentKey((IEnumerable <MemberPath>)set) }, constraints); }
internal void PopulateKeyConstraints(SchemaConstraints <BasicKeyConstraint> constraints) { if (this.m_cellQuery.Extent is EntitySet) { this.PopulateKeyConstraintsForEntitySet(constraints); } else { this.PopulateKeyConstraintsForRelationshipSet(constraints); } }
private void AddKeyConstraints( IEnumerable <ExtentKey> keys, SchemaConstraints <BasicKeyConstraint> constraints) { foreach (ExtentKey key in keys) { List <MemberProjectedSlot> slots = MemberProjectedSlot.GetSlots((IEnumerable <MemberProjectedSlot>) this.m_slots, key.KeyFields); if (slots != null) { BasicKeyConstraint constraint = new BasicKeyConstraint(this, (IEnumerable <MemberProjectedSlot>)slots); constraints.Add(constraint); } } }
private void PopulateKeyConstraintsForEntitySet( SchemaConstraints <BasicKeyConstraint> constraints) { this.AddKeyConstraints((IEnumerable <ExtentKey>)ExtentKey.GetKeysForEntityType(new MemberPath(this.m_cellQuery.Extent), (EntityType)this.m_cellQuery.Extent.ElementType), constraints); }
internal override void ToCompactString(StringBuilder builder) { SchemaConstraints <TKeyConstraint> .ConstraintsToBuilder <TKeyConstraint>((IEnumerable <TKeyConstraint>) this.m_keyConstraints, builder); }