Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dictionary<int, bool> opSucceeded = new Dictionary<int, bool> ();
- for (int i = 0; i < 10; i++)
- {
- try
- {
- // this operation must be atomic
- Operation(dbContext, i);
- // commit (?)
- opSucceeded[i] = true;
- }
- catch
- {
- // ignore
- }
- }
- try
- {
- // this operation must know which Operation(i) has succeeded;
- // it also must be atomic
- FinalOperation(dbContext, opSucceeded);
- // commit all
- }
- catch
- {
- // rollback FinalOperation and operation(i) where opSucceeded[i] == true
- }
Add Comment
Please, Sign In to add comment