views:

31

answers:

0

Hello all

I use nhibernate to access a mysql database, and I have many -winforms- forms using databinding to modify properties of those objects. There are many –nhibernate- objects created/deleted also during the time those forms are used.

I need to implement a "Cancel" button on those forms.

I can defer the creation/deletion of objects on the database (nhibernate’s Session.Save/Delete) to the moment the form is closing. But I don’t know what to do about the changing of loaded objects’ properties directly by the user (changed by winforms databinding) or the adding/removing of objects to the related objects collections.

I’m not a nhibernate expert at all. Is there any way to mark a referenced object as “not loaded yet”, to force a refresh from the DB the next time it is referenced in any way (collections and properties) without losing the reference (kind of return the reference to the proxy object to the initial state, before the first load from the DB)?

I’m not a winforms expert at all neither. How can I know which objects where changed through databinding?