A DataRelation object is also used to create and enforce the following constraints:
- A unique constraint, which guarantees that a column in the table contains no duplicates.
- A foreign-key constraint, which can be used to maintain referential integrity.
A unique constraint is implemented either by simply setting the Unique property of a data column to true, or by adding an instance of the UniqueConstraint class to the DataRelation object's ParentKeyConstraint. As part of the foreign-key constraint, you can specify referential integrity rules that are applied at three points:
- when a parent record is updated
- when a parent record is deleted
- when a change is accepted or rejected