After a bit of trouble today, I have now re-encoded the installment for the above-referenced screencast. I’m still not entirely certain how this happened, but somehow Camtasia Studio decided to silently truncate the final five minutes or so of the screencast during the encoding process. Since I’ve never had any trouble with Camtasia Studio in the past, I’m not really in the habit of listening to the entire final recording before posting it, rather I just listen to the beginning and a some random samples along its length to ensure proper sound levels (after all, not even I want to hear myself talk for another hour and a half!).
It never would have dawned on me to check the last five minutes .
In any case, the corrected version has now been posted for download on the Summer of NHibernate website at the previous link. Sorry for any troubles this may have caused anyone~!
Hi Steve
I am writing a winforms application with NHib and I have problems with NHib session management. I found this article http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html and I think this is what I need. Can you share your experience about session management? Where do you create and destroy sessions, userinterface?
Thanks. Greetings from Bulgaria!
—-
Best regards
mynkow
@mynkow:
It sort of depends a bit on your intent/need. Sometimes, I have done WinForms apps where a single session is constructed from the Main() method and then simply used for the life the application until its closed. Recall (of course) that since the Session doesn’t maintain any open connection to the DB but instead simply opens and closes connections as needed, this can sometimes be a viable strategy.
The other approach is to have a Session-per-form (or related groups of forms) sort of a pattern. In this scenario, if you are using an MVP pattern (probably the recommended way to keep your sanity when building a WinForms application) the session would be created by the view’s presenter (or the ‘parent’ view’s presenter in the case of a series of ‘related’ parent and child forms.
If you’re not using an MVP pattern (then shame-on-you!), then the Form_Load(…) event is about the best place to instantiate a session object as needed for the form.
Basically what it comes down to is this: if several forms share dependencies on common data/objects, then they probably need to also share a session instance so that all the databound objects that could be edited from the collection of forms are able to be maintained in sync with each other.
In a WPF app, this gets trickier to accomplish, but in a WinForms app its usually pretty straightforward to do.
HTH,
-Steve B.
PS: Sorry I’m a few days late in replying to this comment; I’m out of the country at the moment speaking at Oredev 2009 and have had only sporadic opportunity to get online to check my blog, e-mail, etc.