I used to use a SessionScope(FlushAction.Never) and call flush on Save and just do nothing on Cancel. If you have relatively simple forms and only a few forms open at once this works quite well. Having long lived sessions are however not recommended. Also sessionscopes use a stack based model so you can't associated a form with a specific session.
I however have thrown out sessionscopes in my current architecture for direcly managing nhibernate sessions (using AR for mapping/conf only) via a wrapper for more control in my winforms app. On Wed, Sep 9, 2009 at 11:38 AM, Catalin DICU<[email protected]> wrote: > > Hello, > > I have a modal form witch lets the user modify a record. I'd like to > be able to commit changes when the form is closed with "OK" button and > rollback when the form is closed with "Cancel" button. > > How would I do that ? Create a transaction scope in the form > constructor and dispose it when the form closes ? > > What happends if I already have a session ? > > And what SessionScope.Flush() is supposed to do ? It seems like the > canges are send to the database only on Dispose() > > Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
