Hi Kaushik
In ASP.NET you implement this pattern through a Session module.
Create a class implementing IHttpModule:
Code:
public class NHibernateSessionModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(BeginTransaction);
context.EndRequest += new EventHandler(EndTransaction);
}
private void BeginTransaction(object sender, EventArgs e)
{
}
private void EndTransaction(object sender, EventArgs e)
{
}
}
Implement your reconnection in the BeginTransaction.
Finaly, Load the module in your web.config:
Code:
<system.web>
<httpModules>
<add name="NHibernateSessionModule" type="NHibernateSessionModule, <Assembly>"/>
</httpModules>
</system.web>
Hope this helps.
Sérgio