Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- bool bMethod1 = Metthod1();
- bool bMethod2 = Metthod2();
- bool bMethod3 = Metthod3();
- if (!bMethod1 || !bMethod2 || !bMethod3)
- {
- //RollBack
- }
- }
- static void Main(string[] args)
- {
- using (TransactionScope scope = new TransactionScope())
- {
- bool bMethod1 = Metthod1();
- bool bMethod2 = Metthod2();
- bool bMethod3 = Metthod3();
- if (!bMethod1 || !bMethod2 || !bMethod3)
- {
- //RollBack
- Transaction.Current.Rollback();
- }
- if (Transaction.Current.TransactionInformation.Status == TransactionStatus.Committed)
- {
- scope.Complete();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement