Nhibernate,silverlight中具有不同sessionfactory的两个项目,解决了错误的一个
我对 sessionfactory 的绑定以及使用两个 silverlight 项目和两个 sessionfactory 遇到问题。
我有一个“主项目”,它针对一个需要通过 wcf 服务调用访问第二个数据库的数据库。第二个项目(后端)有自己的会话工厂用于访问数据库。
我的问题是,我使用 ManagedWebSessionContext.Bind(HttpContext.Current, _sessionFactory.OpenSession()) 将 sessionfactory 绑定到 HttpContext 以及所有常规服务调用,但是当我在后端项目上调用服务时,我想使用后端-会话工厂。当我进行此调用时,我得到主项目的 sessionfactory,而不是后端项目的 sessionfactory。我怎样才能做到这一点?
I have a problem with the binding of the sessionfactory and working with two silverlight projects and two sessionfactories.
I have one "main-project" which works against one database that need to access a second database trough a wcf-service-call. The second project (backend) has its own sessionfactory for accessing the database.
My problem is that I bind the sessionfactory to the HttpContext with ManagedWebSessionContext.Bind(HttpContext.Current, _sessionFactory.OpenSession()) with all my regular service-calls but when i call the service on the backend-project I want to use the backend-sessionfactory. When I make this call i get the sessionfactory for the main-project instead of the on for the backend-project. How can i do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我们部署到测试服务器时这不是问题,因此只有当我在与调试相同的环境中运行项目时,这似乎才是问题。
This was not a problem when we deployed to our testserver so it's seems to be a problem only if I run the projects in the same environment as I do in debug.