<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Summer of NHibernate Session 13: Managing Session Lifecycle in a Stateless Web Application (corrected) is available</title>
	<atom:link href="http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/feed/" rel="self" type="application/rss+xml" />
	<link>http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/</link>
	<description>Miscellaneous musings on life, .NET development, and related things that don't really matter</description>
	<pubDate>Thu, 17 May 2012 21:20:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sbohlen</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/comment-page-1/#comment-23474</link>
		<dc:creator>sbohlen</dc:creator>
		<pubDate>Fri, 06 Nov 2009 23:10:22 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/#comment-23474</guid>
		<description>@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.</description>
		<content:encoded><![CDATA[<p>@mynkow:</p>
<p>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&#8217;t maintain any open connection to the DB but instead simply opens and closes connections as needed, this can sometimes be a viable strategy.</p>
<p>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&#8217;s presenter (or the &#8216;parent&#8217; view&#8217;s presenter in the case of a series of &#8216;related&#8217; parent and child forms.</p>
<p>If you&#8217;re not using an MVP pattern (then shame-on-you!), then the Form_Load(&#8230;) event is about the best place to instantiate a session object as needed for the form.</p>
<p>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.</p>
<p>In a WPF app, this gets trickier to accomplish, but in a WinForms app its usually pretty straightforward to do.</p>
<p>HTH,</p>
<p>-Steve B.</p>
<p>PS: Sorry I&#8217;m a few days late in replying to this comment; I&#8217;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.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mynkow</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/comment-page-1/#comment-23323</link>
		<dc:creator>mynkow</dc:creator>
		<pubDate>Tue, 03 Nov 2009 10:35:41 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/09/29/summer-of-nhibernate-session-13-managing-session-lifecycle-in-a-stateless-web-application-corrected-is-available/#comment-23323</guid>
		<description>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</description>
		<content:encoded><![CDATA[<p>Hi Steve</p>
<p>I am writing a winforms application with NHib and I have problems with NHib session management. I found this article <a href="http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html" rel="nofollow">http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html</a> and I think this is what I need. Can you share your experience about session management? Where do you create and destroy sessions, userinterface? </p>
<p>Thanks. Greetings from Bulgaria!<br />
&#8212;-<br />
Best regards<br />
mynkow</p>
]]></content:encoded>
	</item>
</channel>
</rss>

