Example #1
0
 internal override void CheckConstraint(DataRow row, DataRowAction action)
 {
     if (Table.EnforceConstraints &&
         (action == DataRowAction.Add ||
          action == DataRowAction.Change ||
          (action == DataRowAction.Rollback && row._tempRecord != -1)))
     {
         if (row.HaveValuesChanged(ColumnsReference))
         {
             if (ConstraintIndex.IsKeyRecordInIndex(row.GetDefaultRecord()))
             {
                 object[] values = row.GetColumnValues(ColumnsReference);
                 throw ExceptionBuilder.ConstraintViolation(ColumnsReference, values);
             }
         }
     }
 }