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)
743
for (int i = 0; i < _table.
Constraints
.Count; i++)
745
if (_table.
Constraints
[i].ContainsColumn(this))
747
throw ExceptionBuilder.ExpressionAndConstraint(this, _table.
Constraints
[i]);
1019
UniqueConstraint? key = _table!.
Constraints
.FindKeyConstraint(this);
1022
_table.
Constraints
.Remove(key);
1041
_table!.
Constraints
.Add(key);
1110
UniqueConstraint? constraint = table!.
Constraints
.FindKeyConstraint(this);
1113
table.
Constraints
.CanRemove(constraint, true);
1234
for (IEnumerator e = _table.
Constraints
.GetEnumerator(); e.MoveNext();)
1241
_table.
Constraints
.CanRemove(oldConstraint, true);
1255
Debug.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)
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)
1103
Tables[i].
Constraints
.FinishInitConstraints();
1182
ConstraintCollection constraints = tbls[i].
Constraints
;
1196
ds.Tables[i].
Constraints
.Add(constraints[j].Clone(ds)!);
3293
ConstraintCollection cons = Tables[i].
Constraints
;
3336
constraints = Tables[i].
Constraints
;
3376
constraints = Tables[i].
Constraints
;
System\Data\DataTable.cs (31)
529
for (int i = 0; i <
Constraints
.Count; i++)
531
Constraint c =
Constraints
[i];
620
Constraints
.Add(uc);
657
Constraints
.Add(fk, false);
1076
foreach (Constraint constraint in
Constraints
)
1207
/// Resets the <see cref='System.Data.DataTable.
Constraints
'/> property to its default state.
1209
private void ResetConstraints() =>
Constraints
.Clear();
1327
foreach (Constraint constr in
Constraints
)
1495
foreach (Constraint constraint in
Constraints
)
1691
if ((existingKey = (UniqueConstraint?)
Constraints
.FindConstraint(key)) != null)
1719
Constraints
.Remove(oldKey);
1725
Constraints
.Add(key);
1730
Debug.Assert(_primaryKey == null ||
Constraints
.FindConstraint(_primaryKey) == _primaryKey, "PrimaryKey is not in ConstraintCollection");
2034
Constraints
.FinishInitConstraints();
2454
for (int j = 0; j <
Constraints
.Count; j++)
2456
ForeignKeyConstraint? foreign =
Constraints
[j] as ForeignKeyConstraint;
2457
UniqueConstraint? unique =
Constraints
[j] as UniqueConstraint;
2463
clone.
Constraints
.FindConstraint(clonedConstraint) is Constraint oldConstraint)
2465
oldConstraint.ConstraintName =
Constraints
[j].ConstraintName;
2472
clone.
Constraints
.FindConstraint(clonedConstraint) is Constraint oldConstraint)
2474
oldConstraint.ConstraintName =
Constraints
[j].ConstraintName;
2484
for (int j = 0; j <
Constraints
.Count; j++)
2486
if (!clone.
Constraints
.Contains(
Constraints
[j].ConstraintName, true))
2488
ForeignKeyConstraint? foreign =
Constraints
[j] as ForeignKeyConstraint;
2489
UniqueConstraint? unique =
Constraints
[j] as UniqueConstraint;
2496
clone.
Constraints
.Add(newforeign);
2501
clone.
Constraints
.Add(unique.Clone(clone)!);
6600
foreach (Constraint tempConstrain in sourceTable.
Constraints
)
6610
if (!destinationTable.
Constraints
.Contains(newFKC.ConstraintName))
6612
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));
1987
ConstraintCollection constraints = table.
Constraints
;
2087
UniqueConstraint? _constraint = (UniqueConstraint?)foreign.RelatedTable.
Constraints
.FindConstraint(new UniqueConstraint("TEMP", fields));
System\Data\XMLSchema.cs (6)
1313
int iExisting = fKey[0].Table!.
Constraints
.InternalIndexOf(name);
1316
if (fKey[0].Table!.
Constraints
[iExisting].ConstraintName != name)
1323
fKey[0].Table!.
Constraints
.Add(fkc);
1418
UniqueConstraint? found = (UniqueConstraint?)key[0].Table!.
Constraints
.FindConstraint(new UniqueConstraint(name, key));
1422
key[0].Table!.
Constraints
.Add(name, key, fPrimaryKey);
1423
SetExtProperties(key[0].Table!.
Constraints
[name]!, keyNode.UnhandledAttributes);