I always want to try to use TransactionScope
but I just can't figure out what people see about it that is useful. So let's take an example:
using(TransactionScope tran = new TransactionScope()) {
CallAMethodThatDoesSomeWork1();
CallAMethodThatDoesSomeWork2();
tran.Complete();
}
So the most basic question: How do I write "CallAMethodThatDoesSomeWork1()
" so that it knows how to roll its actions back if let's say "CallAMethodThatDoesSomeWork2()
" throws an exception?