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(Columns)) { Index index = Key.GetSortIndex(); object[] values = row.GetColumnValues(Columns); if (index.IsKeyInIndex(values)) { #if DEBUG if (CompModSwitches.Data_Constraints.TraceVerbose) { Debug.WriteLine("UniqueConstraint violation..."); string valuesText = ""; for (int i = 0; i < values.Length; i++) { valuesText = Convert.ToString(values[i]) + (i < values.Length - 1 ? ", " : ""); } Debug.WriteLine(" constraint: " + this.GetDebugString()); Debug.WriteLine(" key values: " + valuesText); Range range = index.FindRecords(values); int record = index.GetRecord(range.Min); Debug.WriteLine(" conflicting record: " + record.ToString()); } #endif throw ExceptionBuilder.ConstraintViolation(Columns, values); } } } }
internal override void CheckConstraint(DataRow row, DataRowAction action) { if ((this.Table.EnforceConstraints && (((action == DataRowAction.Add) || (action == DataRowAction.Change)) || ((action == DataRowAction.Rollback) && (row.tempRecord != -1)))) && (row.HaveValuesChanged(this.ColumnsReference) && this.ConstraintIndex.IsKeyRecordInIndex(row.GetDefaultRecord()))) { object[] columnValues = row.GetColumnValues(this.ColumnsReference); throw ExceptionBuilder.ConstraintViolation(this.ColumnsReference, columnValues); } }
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); } } } }
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); } } } }