I need a way to serialize objects in a transactional context.
Given the following pseudo-code:
transation.Begin()
try{
serializeObj(obj1);
serializeObj(obj2);
serializeObj(obj3);
}
catch(Exception){
transaction.RollBack();
}
transaction.Commit();
I want that, after this code runs, or all the objects had been serialized or none of then had been serialized.
I dont think TransactionScpe gives me this ability.
I would prefer some built-in .NET mechanism instead some external library.
Thanks.
If you have a transactional filesystem (transaction ntfs), I think you can achieve what you want via the methods discussed in this and that blog. Also alphafs might be worth a look (they wrote a managed wrapper for the transaction ntfs) but I don’t know the status of the project.