如何更改每个HTTP请求NHibernate的连接字符串? [英] How do you change NHibernate's connection string per HTTP request?

查看:131
本文介绍了如何更改每个HTTP请求NHibernate的连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如上面真的。

推荐答案

这是ISessionFactory.OpenSession()可以用的IDbConnection来提供。

An ISessionFactory.OpenSession() can be supplied with a IDbConnection.

另一种选择是实施IConnectionProvider至极将创建取决于一些条件(其必须是全球性的,从而使这种解决方案不是很干净)适当的IDbConnection实例

Another option is to implement a IConnectionProvider wich would create appropriate IDbConnection instances depending upon some condition (which has to be global, thus rendering this solution not very clean).

这篇关于如何更改每个HTTP请求NHibernate的连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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