Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndoBatch doesn't allow for cancellation of batch #4

Open
nathanaw opened this issue Aug 31, 2017 · 1 comment · Fixed by #8
Open

UndoBatch doesn't allow for cancellation of batch #4

nathanaw opened this issue Aug 31, 2017 · 1 comment · Fixed by #8
Assignees

Comments

@nathanaw
Copy link
Owner

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.


I worked around it with

bool success = true;
using (new UndoBatch(...)) {
    ...
}

if (!success) {
    var root = UndoService.Current[undoroot];
    root.Undo();
}
@nathanaw
Copy link
Owner Author

Thank you for the feedback.

I need to think about this one a bit. For now, I've removed the note in the docs that compares the UndoBatch to TransactionScope.

If we do want to support the "Complete()" type behavior, I think we'll need to add a new "UndoScope" class for that. Changing the UndoBatch's behavior would be a breaking change for those using the library today.

@nathanaw nathanaw linked a pull request Apr 18, 2020 that will close this issue
@nathanaw nathanaw self-assigned this Apr 18, 2020
@nathanaw nathanaw reopened this Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant