tag:blogger.com,1999:blog-31061699.post115385127998541264..comments2022-04-11T23:26:07.499+03:00Comments on Stephan Zahariev's Blog: NHibernate Session ManagementStephan Zaharievhttp://www.blogger.com/profile/11128408750332856474noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-31061699.post-86165415136081874302007-01-18T11:34:00.000+02:002007-01-18T11:34:00.000+02:00This pattern supports lazy loading during the life...This pattern supports lazy loading during the lifetime of the session object. Session object is closed at the end of each request, so lazy loading is supported within the request only. If you want to spread lazy loading among several request you should close only DB connection at the end of request, as a mentioned in the previous comment.Stephan Zaharievhttps://www.blogger.com/profile/11128408750332856474noreply@blogger.comtag:blogger.com,1999:blog-31061699.post-36767263641124914822007-01-16T12:03:00.000+02:002007-01-16T12:03:00.000+02:00Ok, from what i have read so far, your post has ma...Ok, from what i have read so far, your post has made my understand this pattern. I will appreciate if u can send me the source at adrian@saagoo.com. Thanks.<br /><br />PS: From what I know lazy loading is a default strategy in Nhibernate 1.2 b3. Does this pattern (session per request) breaks lazy loading in Nhibernate 1.2beta3?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-31061699.post-1158996557268875502006-09-23T10:29:00.000+03:002006-09-23T10:29:00.000+03:00If I'm developing Windows based application I will...If I'm developing Windows based application I will store session to a singleton object. Inside the singleton object session will be referenced via static ISession member. Also I will have to manually clear session cache (for example when user completes a business transaction).<BR/>If you want to use lazy loading, you must implement session per application transaction. Instead of closing session, just disconnect connection and store the session in the ASP.NET session. When second request arrives, just renew connection to the server. In this scenario, you must manually close the session.Stephan Zaharievhttps://www.blogger.com/profile/11128408750332856474noreply@blogger.comtag:blogger.com,1999:blog-31061699.post-1158962179169437842006-09-23T00:56:00.000+03:002006-09-23T00:56:00.000+03:00How would you manage ISessions if you were to crea...How would you manage ISessions if you were to create a windows application instead of a web-application?<BR/><BR/>I have been using session per request so far and it worked really fine until I discovered that it breaks lazy loading (cause I've already closed the session).Anonymousnoreply@blogger.com