private void Initialize() { this.entitySetToConstraintsMap = new Dictionary <EntitySet, List <PropertyWithConstraints> >(); foreach (AssociationSet associationSet in this.data.EntityContainer.AssociationSets .Where(s => s.AssociationType.ReferentialConstraint != null && this.data[s].Rows.Count > 0)) { ReferentialConstraint refConstraint = associationSet.AssociationType.ReferentialConstraint; EntitySet dependentEntitySet = associationSet.Ends.Where(e => e.AssociationEnd == refConstraint.DependentAssociationEnd).Select(e => e.EntitySet).Single(); List <PropertyWithConstraints> propertiesWithConstraints; if (!this.entitySetToConstraintsMap.TryGetValue(dependentEntitySet, out propertiesWithConstraints)) { propertiesWithConstraints = new List <PropertyWithConstraints>(); this.entitySetToConstraintsMap[dependentEntitySet] = propertiesWithConstraints; } for (int i = 0; i < refConstraint.DependentProperties.Count; i++) { MemberProperty dependentProperty = refConstraint.DependentProperties[i]; PropertyWithConstraints propertyWithConstraints = propertiesWithConstraints.Where(p => p.Property == dependentProperty).SingleOrDefault(); if (propertyWithConstraints == null) { propertyWithConstraints = new PropertyWithConstraints(dependentProperty); propertiesWithConstraints.Add(propertyWithConstraints); } propertyWithConstraints.AddConstraint(new PropertyConstraint(associationSet, i)); } } }
private void ResolveConstraints(EntitySetDataRow row, PropertyWithConstraints propertyWithConstraints) { List <PropertyConstraint> constraints = propertyWithConstraints.GetConstraints(row.EntityType); if (constraints.Count > 0) { this.ResolvePropertyValue(row, propertyWithConstraints.Property, constraints); } }
private void ResolveConstraints(EntitySetDataRow row, PropertyWithConstraints propertyWithConstraints) { List<PropertyConstraint> constraints = propertyWithConstraints.GetConstraints(row.EntityType); if (constraints.Count > 0) { this.ResolvePropertyValue(row, propertyWithConstraints.Property, constraints); } }
private void Initialize() { this.entitySetToConstraintsMap = new Dictionary<EntitySet, List<PropertyWithConstraints>>(); foreach (AssociationSet associationSet in this.data.EntityContainer.AssociationSets .Where(s => s.AssociationType.ReferentialConstraint != null && this.data[s].Rows.Count > 0)) { ReferentialConstraint refConstraint = associationSet.AssociationType.ReferentialConstraint; EntitySet dependentEntitySet = associationSet.Ends.Where(e => e.AssociationEnd == refConstraint.DependentAssociationEnd).Select(e => e.EntitySet).Single(); List<PropertyWithConstraints> propertiesWithConstraints; if (!this.entitySetToConstraintsMap.TryGetValue(dependentEntitySet, out propertiesWithConstraints)) { propertiesWithConstraints = new List<PropertyWithConstraints>(); this.entitySetToConstraintsMap[dependentEntitySet] = propertiesWithConstraints; } for (int i = 0; i < refConstraint.DependentProperties.Count; i++) { MemberProperty dependentProperty = refConstraint.DependentProperties[i]; PropertyWithConstraints propertyWithConstraints = propertiesWithConstraints.Where(p => p.Property == dependentProperty).SingleOrDefault(); if (propertyWithConstraints == null) { propertyWithConstraints = new PropertyWithConstraints(dependentProperty); propertiesWithConstraints.Add(propertyWithConstraints); } propertyWithConstraints.AddConstraint(new PropertyConstraint(associationSet, i)); } } }