This project has moved and is read-only. For the latest updates, please go here.
1
Vote

UndoBatch doesn't allow for cancellation of batch.

description

The documentation says that UndoBatch is designed similarly to TransactionScope, but TransactionScope requires a "ts.Complete()" call to commit, otherwise the change is rolled back. In the current UndoBatch, there's no ability to rollback. Conforming to the TransactionScope pattern, or at least providing some kind of .Rollback() would be very useful.

comments

ses4j wrote Feb 10, 2014 at 1:26 AM

I worked around it with
bool success = true;
using (new UndoBatch(...)) {
    ...
}

if (!success) {
    var root = UndoService.Current[undoroot];
    root.Undo();
}