The event handlers are just a mechanism. The underlying idea is that:

a) all applications need to decide on a strategy for handling the
NHibernate session (and transactions).
b for many applications it makes sense to divide the work into "units of work".
c) for web applications there is in most cases already a clearly
defined unit of work, namely one request to the web server.
d) session and transaction handling is a cross cutting concern - it
would be beneficial to avoid spreading OpenSession() et.al throughout
the code.

so the conclusion is, that for asp.net applications, it is for many
applications a nice solution to open/close the ISession in
Application_BeginRequest/EndRequest, or with a dedicated HTTP module.

You could also try searching the list archives for many discussions on
this topic.

/Oskar


2010/9/16 DavidOs <[email protected]>:
> Hi,
>
> Thanks for this group !
>
> I 'm new in Nhibernate and I want to ask about asp.net.
> I found few articles about it, not much, and they are talking about
> the need to use Http module events
> to create ISession for each request. I don't understand why I need to
> do it, I created a web application and configure just the web.config
> to Nhibernate and it works fine on my local machine.
>
> http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
> http://nhforge.org/blogs/nhibernate/archive/2010/07/11/nhibernate-bootstrapper-unitofwork-and-sessionperrequest.aspx
>
> Can someone explain me why it's so important to use those events
> handlers.
>
> Thanks,
>
> David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to