Tuesday, January 4, 2011

File Transactions (TFX)

There are situations where a transaction span into a database and to the file system, typically this is handled by running the database call inside a transaction scope and the do the file update call after the database call returns.
If the database call fails then nothing is updated into the file system, however if the file update fails then the database transaction is rolled back.
The above approach has to be done for the reason that the file update does not participate with the DTC.
But what if this we are dealing with multiple files, or any other complex scenario?
This is an article one of my friends (Mihidum) forwarded me about NTFS file system transaction,
here is the link.

Too bad, .Net does not support this, and we have to write unmanaged code.