RejectChanges on specific business object.

Mar 1, 2010 at 2:16 AM

First of all i am new to this framework so i apologize for so many questions i have and for the ones that will follow.

Lets say we have the below scenario.

I have a form with a grid and when the form starts i load the grid with some records from the database.

Now, everytime i double click on a row a new form is opening with the values of the selected row. On this form we have three buttons. Proceed, Exit and Undo. So how we undo the selected business entity changes and only.

I have see that there is a RejectChanges method but this method reject changes for the entire collection of the objects and not just for the one i want.

What is your approach on this? If it is not supported right now, are you going to support it in the next versions?

Thank you.

Coordinator
Mar 1, 2010 at 2:56 AM

I see no reason why this cannot be added for each record. This will most likely be in the next version. Keep in mind that it will reject changes sine the last load not before you loaded your form. So if there have been 10 sets of changes it will roll all of them back to the row version from the last database load.

Mar 1, 2010 at 3:38 AM

Hi again.

Yes i absolutely agree with you. It should roll back all the changes since the last load and this is the right behavior. An other thing is about the collections of every object maybe have. A client has a collections of orders. When i reject changes for a client do i expect changes to be rejected for orders also? Well i think things are getting a little bit hard here and i guess you have many things in schedule to implement. I will agree with what ever you think the important part is the reject changes per object. Object Tree reject changes can wait for now. 

Plus i would like to give you an idea about this feature. If it is possible for each object to have

a) a property with the changes that happened to it since the last load. This property could be a hash table with field name and original value

b) and also an enumerated state property (Modified, Not Modified, Deleted).

Lately i was working on a big project with very big business entities and forms with many text boxes. There were times where the user wanted to see the initial value of a field and undo only that insteed of the whole object.

I spent all the night watching your videos, reading the documentation and posts from users. So i found out that each object exposes a set of events for changes so i could still accomplish this functionality by handling this events but the mechanish of tracking the change event from all the objects loaded is hmmm not a good idea to implement if there is an other way. I think the object itself must track its changes. Anyway it is not a must feature, just an idea.

Thank you.

Coordinator
Mar 1, 2010 at 12:54 PM

As to the row state: If RowState is deleted or modified, the row reverts to its previous values, and RowState becomes unchanged. If the RowState is added, the row is removed.

Also each item does have a state in the property "ItemState". Please look at this property for state.

The idea to have a name/property list of changes values is an interesting one as well. This has been added to the wish list and might be implemented.

If RowState is deleted or modified, the row reverts to its previous values, and RowState becomes unchanged. If the RowState is added, the row is removeIf RowState  is deleted or modified, the row reverts to its previous values, and RowState  becomes unchanged. If the RowState  is added, the row is removed.d.
Mar 1, 2010 at 2:59 PM

Probably my head last night was full with so much info that i passed the "ItemState" property every object has.

Thank you.