ChildKeyConstraint
ForeignKeyConstraint fc
= DataRelation.ForeignKeyConstraint;
Retrieves the ForeignKeyConstraint
object that is
associated with this relationship, if it exists. This constraint is
applied to one or more DataColumn
s in the child
table.
The following code retrieves the associated
ForeignKeyConstraint
and uses it to ensure that
cascading deletes are configured for this relationship. This means
that a delete operation that affects the parent row automatically
removes all related child rows as well.
ForeignKeyConstraint fk = dr.ChildKeyConstraint; fk.DeleteRule = Rule.Cascade;