Hi, I have 3 classes concerned with session setup, but the gist of it is this:
Code:
configuration = new NHibernate.Cfg.Configuration();
configuration.AddAssembly(this.GetType().Assembly);
nhibernateFactory = configuration.BuildSessionFactory();
if (activeSession == null || !activeSession.IsOpen)
{
activeSession = nhibernateFactory.OpenSession();
activeSession.FlushMode = FlushMode.Auto;
}
else
throw new InvalidOperationException("The repository already has an open session.");
This all takes place in a Repository class, which is then placed in the HttpContext for use.
If you need the 3 classes seperately I can provide.
Cheers, Ben