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.

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

Please advise.

Thanks

-AM-
 
From memory, I thought this was built into the database engines. You
just switch on a parameter...you might want to ask in a database
group.
 
May be i did not make my point completely clear.
By 'objects modified during the scope of transaction' i meant, the .net
objects. The object instances of my own classes.

Anyway, I am going to raise this post in another group.

Thanks for your reply.

-AM-
 
May be i did not make my point completely clear.
By 'objects modified during the scope of transaction' i meant, the .net
objects.  The object instances of my own classes.

Anyway, I am going to raise this post in another group.

Thanks for your reply.

-AM-


Good luck. You might want to look into the so-called "memento" design
object. Once I had to do a "snapshot" of a state of my objects in C#,
and I used a book by Judith Bishop which is a take off of the Gang of
Four famous book on design patterns for C#, to do a so-called memento
design pattern which allowed me to take snapshots of my objects
state. Worked fine for me, but it's hard to explain by email. Better
to have Bishop's book before you. C# does not allow "read only"
objects so it's a bit trickier than for other languages, but you can
figure it out easily enough if you study it.

RL
 
Good luck.  You might want to look into the so-called "memento" design
object.  Once I had to do a "snapshot" of a state of my objects in C#,
and I used a book by Judith Bishop which is a take off of the Gang of
Four famous book on design patterns for C#, to do a so-called memento
design pattern which allowed me to take snapshots of my objects
state.  Worked fine for me, but it's hard to explain by email.  Better
to have Bishop's book before you.  C# does not allow "read only"
objects so it's a bit trickier than for other languages, but you can
figure it out easily enough if you study it.

RL- Hide quoted text -

- Show quoted text -

Rockford Lhotka's CSLA framework gives you a good foundation taht you
can at least use as a frame of refference if you decide to implement
this yourself.
 
Back
Top