A silly question, perhaps, but at this time of night, StackOverFlow is my only friend.
I’m playing with NHibernate and wanted to factualize these 2 statements regarding Sessions in web applications.
1) You should only ever have 1 ISessionFactory per database for the lifecycle of an application.
2) You should only have 1 ISession per HttpRequest or batch of HttpRequests (i.e. conversation)
[I don’t want tool or framework recommendation, just want to confirm the above]
You should only have one ISessionFactory for the lifecycle of the application.
Session-per-request is how I work with NHibernate. There may be other patterns, but this is the one that I stick to in my web projects.