This enumeration is used to specify two properties of the ForeignKeyConstraint class: ForeignKeyConstraint.UpdateRule and ForeignKeyConstraint.DeleteRule. The value from this enumeration indicates what will happen to the related child rows when a change is made to a parent row. For example, by using a ForeignKeyConstraint.DeleteRule or Cascade, all child rows are removed when the parent row is deleted. If you use SetNull, the foreign key field in the child record is set to a null value. SetDefault restores the default value for the foreign key field; None performs no action.

public enum Rule {

   None = 0,

   Cascade = 1,

   SetNull = 2,

   SetDefault = 3



System.Object System.ValueType System.Enum(System.IComparable, System.IFormattable, System.IConvertible) Rule

Returned By

ForeignKeyConstraint.{DeleteRule, UpdateRule}

Passed To

ForeignKeyConstraint.{DeleteRule, ForeignKeyConstraint( ), UpdateRule}

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.