NHibernate.HibernateException:没有会话绑定到当前上下文 [英] NHibernate.HibernateException: No session bound to the current context

查看:123
本文介绍了NHibernate.HibernateException:没有会话绑定到当前上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试获取CurrentSession时出现此错误

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

NHibernate.Context.CurrentSessionContext.CurrentSession()

NHibernate.Impl.SessionFactoryImpl.GetCurrentSession()

推荐答案

您负责在会话上下文中设置当前会话.请参阅NHibernate文档的本节.如果您尚未执行此操作,则将没有当前会话可供检索.

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.

这篇关于NHibernate.HibernateException:没有会话绑定到当前上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆