Search code examples
nhibernatehibernateexception

NHibernate.HibernateException: No session bound to the current context


I am getting this error when I am trying to get the CurrentSession

NHibernate.Context.CurrentSessionContext.CurrentSession()

at

NHibernate.Impl.SessionFactoryImpl.GetCurrentSession()

Solution

  • You are responsible for setting the current session on the session context. See this section of the NHibernate documentation. If you haven't done this, then there will be no current session to retrieve.