81 references to Constraints
System.Data.Common (81)
System\Data\Constraint.cs (2)
47
Table.
Constraints
.RegisterName(value);
49
Table.
Constraints
.UnregisterName(_name);
System\Data\ConstraintCollection.cs (2)
120
UniqueConstraint? key = fk.RelatedTable.
Constraints
.FindKeyConstraint(fk.RelatedColumnsReference);
129
fk.RelatedTable.
Constraints
.Add(key);
System\Data\ConstraintEnumerator.cs (1)
37
_constraints = ((DataTable)_tables.Current).
Constraints
.GetEnumerator();
System\Data\DataColumn.cs (13)
742
for (int i = 0; i < _table.
Constraints
.Count; i++)
744
if (_table.
Constraints
[i].ContainsColumn(this))
746
throw ExceptionBuilder.ExpressionAndConstraint(this, _table.
Constraints
[i]);
1018
UniqueConstraint? key = _table!.
Constraints
.FindKeyConstraint(this);
1021
_table.
Constraints
.Remove(key);
1040
_table!.
Constraints
.Add(key);
1109
UniqueConstraint? constraint = table!.
Constraints
.FindKeyConstraint(this);
1112
table.
Constraints
.CanRemove(constraint, true);
1233
for (IEnumerator e = _table.
Constraints
.GetEnumerator(); e.MoveNext();)
1240
_table.
Constraints
.CanRemove(oldConstraint, true);
1254
Debug.Assert(_table.
Constraints
.FindKeyConstraint(this) == null, "Should not be a duplication constraint in collection");
1255
_table.
Constraints
.Add(constraint);
1259
_table.
Constraints
.Remove(oldConstraint!);
System\Data\DataColumnCollection.cs (4)
511
for (int i = 0; i < _table.
Constraints
.Count; i++)
513
if (_table.
Constraints
[i].ContainsColumn(column))
517
throw ExceptionBuilder.CannotRemoveConstraint(_table.
Constraints
[i].ConstraintName, _table.
Constraints
[i].Table!.TableName);
System\Data\DataRelation.cs (2)
486
ForeignKeyConstraint? constraint = ChildTable.
Constraints
.FindForeignKeyConstraint(ChildKey.ColumnsReference, ParentKey.ColumnsReference);
791
foreach (Constraint cs in ChildTable.
Constraints
)
System\Data\DataRelationCollection.cs (3)
806
ForeignKeyConstraint? foreignKey = relation.ChildTable.
Constraints
.FindForeignKeyConstraint(relation.ParentColumnsReference, relation.ChildColumnsReference);
811
relation.ChildTable.
Constraints
.Add(foreignKey = new ForeignKeyConstraint(relation.ParentColumnsReference, relation.ChildColumnsReference));
824
UniqueConstraint? key = relation.ParentTable.
Constraints
.FindKeyConstraint(relation.ParentColumnsReference);
System\Data\DataSet.cs (6)
1093
Tables[i].
Constraints
.FinishInitConstraints();
1172
ConstraintCollection constraints = tbls[i].
Constraints
;
1186
ds.Tables[i].
Constraints
.Add(constraints[j].Clone(ds)!);
3237
ConstraintCollection cons = Tables[i].
Constraints
;
3280
constraints = Tables[i].
Constraints
;
3320
constraints = Tables[i].
Constraints
;
System\Data\DataTable.cs (31)
524
for (int i = 0; i <
Constraints
.Count; i++)
526
Constraint c =
Constraints
[i];
615
Constraints
.Add(uc);
652
Constraints
.Add(fk, false);
1071
foreach (Constraint constraint in
Constraints
)
1202
/// Resets the <see cref='System.Data.DataTable.
Constraints
'/> property to its default state.
1204
private void ResetConstraints() =>
Constraints
.Clear();
1322
foreach (Constraint constr in
Constraints
)
1490
foreach (Constraint constraint in
Constraints
)
1686
if ((existingKey = (UniqueConstraint?)
Constraints
.FindConstraint(key)) != null)
1714
Constraints
.Remove(oldKey);
1720
Constraints
.Add(key);
1725
Debug.Assert(_primaryKey == null ||
Constraints
.FindConstraint(_primaryKey) == _primaryKey, "PrimaryKey is not in ConstraintCollection");
2029
Constraints
.FinishInitConstraints();
2449
for (int j = 0; j <
Constraints
.Count; j++)
2451
ForeignKeyConstraint? foreign =
Constraints
[j] as ForeignKeyConstraint;
2452
UniqueConstraint? unique =
Constraints
[j] as UniqueConstraint;
2458
clone.
Constraints
.FindConstraint(clonedConstraint) is Constraint oldConstraint)
2460
oldConstraint.ConstraintName =
Constraints
[j].ConstraintName;
2467
clone.
Constraints
.FindConstraint(clonedConstraint) is Constraint oldConstraint)
2469
oldConstraint.ConstraintName =
Constraints
[j].ConstraintName;
2479
for (int j = 0; j <
Constraints
.Count; j++)
2481
if (!clone.
Constraints
.Contains(
Constraints
[j].ConstraintName, true))
2483
ForeignKeyConstraint? foreign =
Constraints
[j] as ForeignKeyConstraint;
2484
UniqueConstraint? unique =
Constraints
[j] as UniqueConstraint;
2491
clone.
Constraints
.Add(newforeign);
2496
clone.
Constraints
.Add(unique.Clone(clone)!);
6558
foreach (Constraint tempConstrain in sourceTable.
Constraints
)
6568
if (!destinationTable.
Constraints
.Contains(newFKC.ConstraintName))
6570
destinationTable.
Constraints
.Add(newFKC); // we know that the dest table is already in the table
System\Data\Merger.cs (5)
472
for (int i = 0; i < table.
Constraints
.Count; i++)
474
Constraint src = table.
Constraints
[i];
486
Constraint? cons = dest.Table!.
Constraints
.FindConstraint(dest);
494
dest.Table.
Constraints
.Add(dest);
500
dest.Table.
Constraints
.Add(dest);
System\Data\ProviderBase\SchemaMapping.cs (1)
1088
ConstraintCollection constraints = _dataTable.
Constraints
;
System\Data\xmlsaver.cs (5)
286
foreach (Constraint constr in table.
Constraints
)
439
foreach (Constraint cs in dt.
Constraints
)
453
UniqueConstraint? _constraint = (UniqueConstraint?)fk.RelatedTable.
Constraints
.FindConstraint(new UniqueConstraint("TEMP", fk.RelatedColumnsReference));
1977
ConstraintCollection constraints = table.
Constraints
;
2077
UniqueConstraint? _constraint = (UniqueConstraint?)foreign.RelatedTable.
Constraints
.FindConstraint(new UniqueConstraint("TEMP", fields));
System\Data\XMLSchema.cs (6)
1307
int iExisting = fKey[0].Table!.
Constraints
.InternalIndexOf(name);
1310
if (fKey[0].Table!.
Constraints
[iExisting].ConstraintName != name)
1317
fKey[0].Table!.
Constraints
.Add(fkc);
1412
UniqueConstraint? found = (UniqueConstraint?)key[0].Table!.
Constraints
.FindConstraint(new UniqueConstraint(name, key));
1416
key[0].Table!.
Constraints
.Add(name, key, fPrimaryKey);
1417
SetExtProperties(key[0].Table!.
Constraints
[name]!, keyNode.UnhandledAttributes);