Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. bool bMethod1 = Metthod1();
  4. bool bMethod2 = Metthod2();
  5. bool bMethod3 = Metthod3();
  6.  
  7. if (!bMethod1 || !bMethod2 || !bMethod3)
  8. {
  9. //RollBack
  10. }
  11. }
  12.  
  13. static void Main(string[] args)
  14. {
  15. using (TransactionScope scope = new TransactionScope())
  16. {
  17.  
  18. bool bMethod1 = Metthod1();
  19. bool bMethod2 = Metthod2();
  20. bool bMethod3 = Metthod3();
  21.  
  22. if (!bMethod1 || !bMethod2 || !bMethod3)
  23. {
  24. //RollBack
  25. Transaction.Current.Rollback();
  26. }
  27. if (Transaction.Current.TransactionInformation.Status == TransactionStatus.Committed)
  28. {
  29. scope.Complete();
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement