Transaction Rollback and Object State

A

Aamir Mahmood

Hi

I am using System.Transactions.TransactionScope to implement the
transactions in my code.

When the transaction is rolled back because of any reason, I want all the
objects that were modified in the transaction scope to be in their initial
(pre-transaction) state.

By 'all the objects' I mean the C# object instances that were modified (any
property, field changed) during the transaction.

Is there something already available in .net? Or some standard approach I
should follow.

Please advise.

Thanks

-AM-
 
M

Miha Markic

No, there is nothing like that out of the box.
What I do is that I serialize all the objects before entering the
transaction and if rollback occurs I recreate the objects from serialized
data.
Serialization isn't the recipe for every situation of course.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top