question about the purpose of the module

Jul 15, 2010 at 6:43 PM
Hello Chinhdo I checked all of your source code ,I have a question , when user want to copy a file ,he can use the "File" class of .net ,such as File.copy... hmm... for your code ,maybe I can use fileMgr.CopyFile(srcFileName, destFileName); can you show me the difference of them,hmm... since that I am not clear of can you show me the purpose of the module ,such as why I should use the module with my development ,and when I should use the module thank you very much:)
Jul 16, 2010 at 2:10 AM

Hi Coocle:

The main difference between File.Copy and TxFileManager.CopyFile is that the TxFileManager version will automatically enlist your file copy operation in a transaction, so that it can be rolled back later, if required.

You can also include File.Copy in a transaction also, but first you have to call TxFileManager.SnapShot on the target file name, so that TxFileManager knows about the file and can roll it back later if needed.

The main purpose of the module is to allow you to easily wrap file operations (such as copy, move, delete) in transactions, like you can typically wrap database operations in a transaction.

Hope this helps.



Jul 18, 2010 at 3:30 AM
Hello Chinhdo Thank you very much ,hmm... I have never use "Transaction",and I think your module is a good solution for file operation in a transaction , I need to take a time to study it ,and also "Transaction", maybe it is a good idea in my future .net development. Thank you very much:)