views:

153

answers:

1

I've been using TransactionScope to work with the database and it feels nice. What I'm looking for is the following:

using(var scope=new TransactionScope())
{               
    // Do something with a few files...
    scope.Complete();
}

but obviously this doesn't work -- if there are 20 files, and an exception occurs on the 9th file, all previous 8 remain changed and the rest unchanged -- no rollback is performed. So, what would be the best way to implement a scope-like behavior for files?

I'm hoping there is a simple answer, but if not, could you just give me a few pointers, or point me to an related article?

+2  A: 

You're looking for Transactional NTFS, introduced by Windows Vista.

Here is a managed wrapper.

SLaks
Thanks, that appears to be exactly what I was looking for.
avance70
Unfortunately, their managed wrapper wraps each function in a transaction scope of its own. I had to create overloads which allowed me to pass in my own scope.
Jesse C. Slicer