SaveFields and Entity rollback.

Posts   
 
    
demetir
User
Posts: 5
Joined: 06-Sep-2007
# Posted on: 12-Dec-2007 09:47:14   

Hi there,

I need to rollback changes made to an entity including related entities that exist on a parent entity.

The SaveFields and RollBackFields methods aren't sufficient as they only store the field information of the parent entity, and don't support rollback of entitycollections (that have had entities modified/added/deleted) or related entity objects.

To get around this I create a copy of the the entity using binary serialisation before it is modified. If the edit is canceled I then return the copy instead of the original modified entity.

Is this the best way to go about ensuring a complete rollback? Or is there a better alternative method?

Regards, Demetri.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Dec-2007 10:09:45   

Graph versioning isn't included in LLBLGen Pro.

If these changes were persisted in the database, then you might consider using a Transaction & Transaction savepoints. ref: LLBLGen Pro manual "Using the generated code -> Adapter/SlefServicing -> Transactions"

If you are doing things in memory, then your solution is the best thing to do. Also you can refetch the entire graph again.

This topic was discussed many times lately, please check the following links: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11347 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11352 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=9445