hi
I’m designing my first asp.net web app, using nHibernate as the data provider.
i’ve read a lot about nhibernate in web applications using session-per-request pattern.
my application will have a few pages which are ‘monitors’, meaning- they’re updated automatically every few seconds to reflect recent changes to data.
in that case, my thought is that opening a session for every request would not make much sense, since I know that an identical request is sure to follow in a few seconds.
my thought is that session-per-conversation would make more sense for me, but I’m having trouble finding examples of implementations.
I’d appreciate any good resources for how to implement session-per-conversation, and any other ideas / suggestions you may have.
thanks
Jhonny
A session-per-request is still a good idea, as you don’t know, in a web-scenerio, when a conversation ends. There’s not much overhead to opening/closing a session, and the connection is only kept open whilst the session is in a transaction.
, and, as a session wraps a database connection, you’re simply using up connections from the connection pool by keeping your sessions open.if you’re stuck on a session-per-conversation stuff, look at NHibernate.Burrow – this handles all the conversation/session management stuff for you.