I have a WinForm application which uses SqlServer CE 3.5 as database. I use typed dataset queries for db operations. I need to use transactions for this operations. The problem is, they're scattered across different assemblies. My question is, what should I use to run all of them in a single transaction? Here's an example operation:
//transaction should start here
this.QueryDb();
MyOtherAssembly.myClass.QueryDbForSomethingElse();
System.IO.File.Delete(fileName);
//end transaction
I'm thinking of using TransactionScope
but would it work in this situation? I mean would QueryDbForSomethingElse()
rollback if File.Delete()
fails? Should I pass Transaction.Current
or Transaction.Current.DependentClone(DependentCloneOption.BlockCommitUntilComplete)
as a parameter to it and create a new transaction there using passed parameter?
I'd appreciate any ideas on this.