How to Accommodate Multiple Undos?

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
Luthfi
Posts: 6
Joined: Fri 09 Jan 2015 13:39

How to Accommodate Multiple Undos?

Post by Luthfi » Fri 09 Jan 2015 14:12

I know that calling TMappedEntity.Cancel will cancel any modifications. But I believe it will simply cancel all modifications. What if I have several stages in editing my entities? And in each stage I need to be able to undo to prior stage's state?

Thanks!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to Accommodate Multiple Undos?

Post by AlexP » Mon 12 Jan 2015 09:18

Hello,

The Cancel method cancels all changes applied to an instance before calling the Save or SubmitChanges methods. After calling these methods, cancel is unavailable, since changes are saved in the database. Please describe the needed functionality in more details (several stages in editing my entities) - and we will try to help you solve the issue.

Luthfi
Posts: 6
Joined: Fri 09 Jan 2015 13:39

Re: How to Accommodate Multiple Undos?

Post by Luthfi » Tue 13 Jan 2015 08:06

Hi Alex,

Thank you very much for the reply. In the current project (which is the first time I am using EntityDAC) I haven't encountered the need to go multiple stages upon editing an object. However I have met such requirements before in my previous projects. So this question is to anticipate when such requirement arises.

In my previous projects, I solved this requirement my creating a copy/clone of the original object/entity for each stage. I don't know how to implement this in EntityDAC since the entities need to be attached to an entityContext to work properly (especially when the entities containing TCollectionData properties).

Can you point me to easy way to create temporary copies of an entity?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to Accommodate Multiple Undos?

Post by AlexP » Tue 13 Jan 2015 13:17

There is no capability to copy/clone objects for the time being. Please send a small sample or a code abstract demonstrating step-by-step editing - we will try to find a solution with no need to copy objects.

Post Reply