コード例 #1
0
ファイル: UniqueConstraint.cs プロジェクト: pgovind/runtime
 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);
             }
         }
     }
 }