81 references to Constraints
System.Data.Common (81)
System\Data\Constraint.cs (2)
47Table.Constraints.RegisterName(value); 49Table.Constraints.UnregisterName(_name);
System\Data\ConstraintCollection.cs (2)
120UniqueConstraint? key = fk.RelatedTable.Constraints.FindKeyConstraint(fk.RelatedColumnsReference); 129fk.RelatedTable.Constraints.Add(key);
System\Data\ConstraintEnumerator.cs (1)
37_constraints = ((DataTable)_tables.Current).Constraints.GetEnumerator();
System\Data\DataColumn.cs (13)
743for (int i = 0; i < _table.Constraints.Count; i++) 745if (_table.Constraints[i].ContainsColumn(this)) 747throw ExceptionBuilder.ExpressionAndConstraint(this, _table.Constraints[i]); 1019UniqueConstraint? key = _table!.Constraints.FindKeyConstraint(this); 1022_table.Constraints.Remove(key); 1041_table!.Constraints.Add(key); 1110UniqueConstraint? constraint = table!.Constraints.FindKeyConstraint(this); 1113table.Constraints.CanRemove(constraint, true); 1234for (IEnumerator e = _table.Constraints.GetEnumerator(); e.MoveNext();) 1241_table.Constraints.CanRemove(oldConstraint, true); 1255Debug.Assert(_table.Constraints.FindKeyConstraint(this) == null, "Should not be a duplication constraint in collection"); 1256_table.Constraints.Add(constraint); 1260_table.Constraints.Remove(oldConstraint!);
System\Data\DataColumnCollection.cs (4)
511for (int i = 0; i < _table.Constraints.Count; i++) 513if (_table.Constraints[i].ContainsColumn(column)) 517throw ExceptionBuilder.CannotRemoveConstraint(_table.Constraints[i].ConstraintName, _table.Constraints[i].Table!.TableName);
System\Data\DataRelation.cs (2)
486ForeignKeyConstraint? constraint = ChildTable.Constraints.FindForeignKeyConstraint(ChildKey.ColumnsReference, ParentKey.ColumnsReference); 791foreach (Constraint cs in ChildTable.Constraints)
System\Data\DataRelationCollection.cs (3)
806ForeignKeyConstraint? foreignKey = relation.ChildTable.Constraints.FindForeignKeyConstraint(relation.ParentColumnsReference, relation.ChildColumnsReference); 811relation.ChildTable.Constraints.Add(foreignKey = new ForeignKeyConstraint(relation.ParentColumnsReference, relation.ChildColumnsReference)); 824UniqueConstraint? key = relation.ParentTable.Constraints.FindKeyConstraint(relation.ParentColumnsReference);
System\Data\DataSet.cs (6)
1103Tables[i].Constraints.FinishInitConstraints(); 1182ConstraintCollection constraints = tbls[i].Constraints; 1196ds.Tables[i].Constraints.Add(constraints[j].Clone(ds)!); 3293ConstraintCollection cons = Tables[i].Constraints; 3336constraints = Tables[i].Constraints; 3376constraints = Tables[i].Constraints;
System\Data\DataTable.cs (31)
529for (int i = 0; i < Constraints.Count; i++) 531Constraint c = Constraints[i]; 620Constraints.Add(uc); 657Constraints.Add(fk, false); 1076foreach (Constraint constraint in Constraints) 1207/// Resets the <see cref='System.Data.DataTable.Constraints'/> property to its default state. 1209private void ResetConstraints() => Constraints.Clear(); 1327foreach (Constraint constr in Constraints) 1495foreach (Constraint constraint in Constraints) 1691if ((existingKey = (UniqueConstraint?)Constraints.FindConstraint(key)) != null) 1719Constraints.Remove(oldKey); 1725Constraints.Add(key); 1730Debug.Assert(_primaryKey == null || Constraints.FindConstraint(_primaryKey) == _primaryKey, "PrimaryKey is not in ConstraintCollection"); 2034Constraints.FinishInitConstraints(); 2454for (int j = 0; j < Constraints.Count; j++) 2456ForeignKeyConstraint? foreign = Constraints[j] as ForeignKeyConstraint; 2457UniqueConstraint? unique = Constraints[j] as UniqueConstraint; 2463clone.Constraints.FindConstraint(clonedConstraint) is Constraint oldConstraint) 2465oldConstraint.ConstraintName = Constraints[j].ConstraintName; 2472clone.Constraints.FindConstraint(clonedConstraint) is Constraint oldConstraint) 2474oldConstraint.ConstraintName = Constraints[j].ConstraintName; 2484for (int j = 0; j < Constraints.Count; j++) 2486if (!clone.Constraints.Contains(Constraints[j].ConstraintName, true)) 2488ForeignKeyConstraint? foreign = Constraints[j] as ForeignKeyConstraint; 2489UniqueConstraint? unique = Constraints[j] as UniqueConstraint; 2496clone.Constraints.Add(newforeign); 2501clone.Constraints.Add(unique.Clone(clone)!); 6600foreach (Constraint tempConstrain in sourceTable.Constraints) 6610if (!destinationTable.Constraints.Contains(newFKC.ConstraintName)) 6612destinationTable.Constraints.Add(newFKC); // we know that the dest table is already in the table
System\Data\Merger.cs (5)
472for (int i = 0; i < table.Constraints.Count; i++) 474Constraint src = table.Constraints[i]; 486Constraint? cons = dest.Table!.Constraints.FindConstraint(dest); 494dest.Table.Constraints.Add(dest); 500dest.Table.Constraints.Add(dest);
System\Data\ProviderBase\SchemaMapping.cs (1)
1088ConstraintCollection constraints = _dataTable.Constraints;
System\Data\xmlsaver.cs (5)
286foreach (Constraint constr in table.Constraints) 439foreach (Constraint cs in dt.Constraints) 453UniqueConstraint? _constraint = (UniqueConstraint?)fk.RelatedTable.Constraints.FindConstraint(new UniqueConstraint("TEMP", fk.RelatedColumnsReference)); 1987ConstraintCollection constraints = table.Constraints; 2087UniqueConstraint? _constraint = (UniqueConstraint?)foreign.RelatedTable.Constraints.FindConstraint(new UniqueConstraint("TEMP", fields));
System\Data\XMLSchema.cs (6)
1313int iExisting = fKey[0].Table!.Constraints.InternalIndexOf(name); 1316if (fKey[0].Table!.Constraints[iExisting].ConstraintName != name) 1323fKey[0].Table!.Constraints.Add(fkc); 1418UniqueConstraint? found = (UniqueConstraint?)key[0].Table!.Constraints.FindConstraint(new UniqueConstraint(name, key)); 1422key[0].Table!.Constraints.Add(name, key, fPrimaryKey); 1423SetExtProperties(key[0].Table!.Constraints[name]!, keyNode.UnhandledAttributes);