I’m learning NHibernate and was looking at some code recently where NHibernate was used in an ASP.Net MVC project.
In a certain part of this app, entities loaded from NH are being kept in the (HttpContext) Session. Is this OK, or are there any dangers with this if you use (NHibernate) Session-per-request pattern?
I wouldn’t recommend it unless you really know what you’re doing. Off the top of my head:
If you want to have cross-request conversations check out NHibernate.Burrow which is a framework designed for this specific purpose.