Hi jta - thanks for your reply. I'll try to elaborate a bit.
I have an HttpModule that does the following:
BeginRequest:
Create an NHibernate transaction and saves it in my session manager.
The web application carries on with its work. It reads and modifies objects from the database using a session object in the session manager. When an object is requested an ISession object is created by my session manager and reused for the rest of the lifetime of the request.
EndRequest:
CommitTransaction and close session.
I believe the pattern above is called "Session in View". Correct me if I am wrong.
I find it very convenient that I do not have to think about opening and closing sessions in the web code. I am concerned, however, that this pattern is sucking up to many resources in terms of database connections etc.
Does anyone have any experience with this pattern when it comes to performance?
Cheers,
Thomas
|