I'm trying to make an undo system for my application using adonet. The
idea is simple: before performing the undoable operation make the copy
of dataset. If the user wants to undo the changes, then restore the
data from the old dataset.
I have the following issues:
1. Many objects througth the form have references to a dataset and/or
it's tables. So it is not enough just to replace the _dataSet variable
but I would need to rebind all controls. I don't like it.
2. Because of what I said in the first bullet I am trying to replace
the data inside the existing dataset like this:
if (_copyOfDataSet != null) {
_dataSet.Clear();
_dataSet.Merge(_copyOfDataSet, false);
}
but I'm far from sure that it warks as expected. So far, my simple
experiments have shown that it works but I'm looking for your ideas
and suggestions.
Actually there are n copies of dataset after the user performs n
undoable operations so I'm not looking for Accept/Reject Changes
solution which would support only one "undo" operation.
Thanks
|