private SetValue ( int record, object value ) : void | ||
record | int | |
value | object | |
return | void |
internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue) { // get record for version int record = dr.GetRecordFromVersion(version); bool equalValues = false; if (DataStorage.IsTypeCustomType(dc.DataType) && newValue != dc[record]) { // if UDT storage, need to check if reference changed. See bug 385182 equalValues = false; } else { equalValues = dc.CompareValueTo(record, newValue, true); } // if expression has changed if (!equalValues) { int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version);// conditional, if it exists it will try to remove with no event fired dc.SetValue(record, newValue); int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version);// conditional, it will insert if it qualifies, no event will be fired if (dr.HasVersion(version)) { if (version != DataRowVersion.Original) { dr.Table.RecordChanged(oldIndex, newIndex); } if (dc.dependentColumns != null) { //BugBug - passing in null for cachedRows. This means expression columns as keys does not work when key changes. dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null); } } } dr.ResetLastChangedColumn(); }
internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue) { int recordFromVersion = dr.GetRecordFromVersion(version); bool flag = false; if (DataStorage.IsTypeCustomType(dc.DataType) && (newValue != dc[recordFromVersion])) { flag = false; } else { flag = dc.CompareValueTo(recordFromVersion, newValue, true); } if (!flag) { int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version); dc.SetValue(recordFromVersion, newValue); int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version); if (dr.HasVersion(version)) { if (version != DataRowVersion.Original) { dr.Table.RecordChanged(oldIndex, newIndex); } if (dc.dependentColumns != null) { dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null); } } } dr.ResetLastChangedColumn(); }