.net - Pass current transaction or use DependentClone? -


I have a WinForm application that uses SQL Server 3.5 as a database. I use dataset queries typed for the DB operation. I have to use the transaction for this operation. The problem is, they are spread in different assemblies. My question is, what should I use to run them all in a transaction? Here's an example operation:

  // Transactions should start here here. MyOtherAssembly.myClass.QueryDbForSomethingElse (); System.IO.File.Delete (file name); // End transaction  

I'm thinking of using TransactionScope but will it work in this situation? I would mean QueryDbForSomethingElse () rollback if File.Delete () fails? Should I make a new transaction using the transaction.Current or Transaction.Current.DependentClone (DependentCloneOption.BlockCommitUntilComplete) as a parameter and using passed parameters?

I appreciate any thoughts on this.

TransactionScope works in assemblies - it actually does not care where The code is implemented, rather, it is related to the current execution reference (the current thread, if I am not mistaken).

However, the Windows file system is not transactional, so no matter how you try to designate your code, a transaction, file operations are not taking any part in it unless we A transitional file system is not found, you can not write an application that guarantees the ADID transaction, if file operation is included.

Instead, you have to implement compensation actions.

FWID, however, you want to take a look at Juwel Lowey's MSDN magazine article.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -