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.

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

Please advise.

Thanks

-AM-
 
R

raylopez99

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.
 
A

Aamir Mahmood

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-
 
R

raylopez99

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
 
G

G.S.

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.
 

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