Craig Miskell wrote:
> It is becoming apparent that we will be needing rollback/revert
> functionality in DataContext. I'm happy to do so, but would be
> interested if anyone has previously given any thought to this and how it
> might be attacked.
I haven't thought much about it yet, but agree it would be nice to have;
if you can do it because you need it, all the better. Off the top of my
head I think it would be nice to be able to:
- zap a single object back into snapshot/proxy (hollow) state
- undo the last n edits of a single object
- undo the last n operations on a DataContext
- revert all inserted/updated/deleted objects of a DataContext
- revert all fetched objects of a DataContext
Hmm..some of this looks suspiciously familiar. :-)
First one should be easy, I think it's already in there?
Second one would obviously work through the setters, but might quickly
become a memory hog and needs configurable undo queue size per ObjEntity.
Third and fourth one look easy: just iterate over the respective ObjectIds
and throw them out of the change set or plaster the snapshots over the
objects. On second thought this could get tricky if e.g. a new object is
inserted, set as another object's toOne target, and then just removed from
the insertedObjects set - dangling reference. I cannot remember what
NSUndoManager does in this case.
Last one is probably the easiest, just zap all non-hollow (what's the
word, committed?) objects like in the first case.
-h
This archive was generated by hypermail 2.0.0 : Sat Nov 30 2002 - 23:29:58 EST