MarcoP wrote:
Otis wrote:
I'm not sure if you want to cancel edits on single entities or that the cancel cancels edits on all entities currently edited in a cycle. This is important as you could for example then simply decide to throw away the current customer instance and recreate a new one, which will load the phone numbers automatically.
I dont mind re-creating the customer instance if the user clicks cancel (I thought the refetch would re-load the related entities as well). But the thing is, I have a grid bound to a collection of customers and when the user clicks a customer row, i bring up the edit screen. How could I kill the current customer instance and make sure the collection is in sync with this?
Then SaveFields() is a better option as that will signal the thread to refresh the row as well in the grid and you're not running into nasty databinding issues. Refetch doesn't fetch related entities, it just reloads the entity from the db so an out-of-sync entity is again up to date.
That was my whole premise with using the refetch, since I'm still dealing with the same instance, but I'm telling him to re-load himself. So let me make sure, the refetch only refetche's his data, not for example his phone #'s data if it changed?
Yes, it doesn't refetch any related data.
So if thats the case, when I called refetch, the customer data would be rolled back, but the customer would still have 'dirty' phone #'s?
Yes, so you have to implement some sort of rollback mechanism on the related collections as well.
There wasn't enough time to implement full collection state save/rollback and full entity state save/rollback, as it will cause a lot of confusion with some object graphs and it's not certain if it will be a viable feature (i.e.: more trouble than joy).