NHibernate Transactions in Open View per Session - suggested practices?

Most people use a session-per-request strategy as stated in your first bullet point. However, I don't believe that the transaction needs to be committed on EndRequest. In many web pages it would be easier to commit the transaction based on user action (e.g. Clicking submit) and let EndRequest just handle disposing the ISession.

Most people use a session-per-request strategy as stated in your first bullet point. However, I don't believe that the transaction needs to be committed on EndRequest. In many web pages it would be easier to commit the transaction based on user action (e.g. Clicking submit) and let EndRequest just handle disposing the ISession.

As far as I can tell, there's no need to create an HttpModule as the same functionality can be created in global. Asax: forum.hibernate.org/viewtopic.php?t=993041.

You can use a IoC Container for your service layer and the container can manage the transaction and the Nibenrate Session. Your WebApp Controller => call (A) Service Layer => call (B) one or several DAO methods /operations. The IoC container like Spring.NET will manage te TX scope, by example at (A) and will provide a Session to your DAO in (B).

The commit (or rollback) will be handled at the end of the service layer call.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions