private bool ForeignKeyConstraintPredicate(IMetadataConstraints constraints, IMetadataConstraints otherConstraints, RelationConstraint c) { return(ConstraintPredicate(otherConstraints, c, RelationConstraintType.FOREIGN_KEY, otherConstraint => !otherConstraints.RelationConstraintsByName.Values.Contains(c) || !otherConstraints.ReferenceConstraintsByName.Values.Contains(constraints.ReferenceConstraintsByName[c.ConstraintName]))); }
private bool ConstraintPredicate( IMetadataConstraints otherConstraints, RelationConstraint c, RelationConstraintType relationConstraintType, Func <RelationConstraint, bool> predicate) { if (c.RelationConstraintType != relationConstraintType) { return(false); } if (!FilterSystemFlagUserPredicate(c.Relation)) { return(false); } if (relationConstraintType != RelationConstraintType.FOREIGN_KEY && !Metadata.MetadataRelations.Relations.ContainsKey(c.RelationName)) { return(false); } var otherConstraint = otherConstraints.RelationConstraintsByName.Values.FirstOrDefault(x => x == c); if (otherConstraint != null) { return(predicate == null ? otherConstraint != c : otherConstraint != c || predicate(otherConstraint)); } return(true); }
private static IEnumerable <RelationConstraint> FilterCheckRelationConstraintsConstraints(IMetadataConstraints metadataConstraints) { return(metadataConstraints.RelationConstraintsByName.Values .Where(x => x.RelationConstraintType == RelationConstraintType.CHECK)); }
private bool UniqueConstraintPredicate(IMetadataConstraints constraints, IMetadataConstraints otherConstraints, RelationConstraint c) { return(ConstraintPredicate(otherConstraints, c, RelationConstraintType.UNIQUE, null)); }
private bool PrimaryKeyConstraintPredicate(IMetadataConstraints constraints, IMetadataConstraints otherConstraints, RelationConstraint c) { return(ConstraintPredicate(otherConstraints, c, RelationConstraintType.PRIMARY_KEY, null)); }