Transaction Rollback and Object State

  • Thread starter Thread starter Aamir Mahmood
  • Start date Start date
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-
 
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.
 
Back
Top