NHibernate w/通过连接字符串中的故障转移伙伴进行数据库镜像

本文关键字:伙伴 转移 故障 镜像 数据库 字符串 连接 NHibernate | 更新日期: 2023-09-27 18:27:01

在回答这个问题之前,我会说我正在使用NHibernate v3.2
假设我有一个如下的连接字符串(这里的密钥是Failover Partner):

Data Source=Server1'Instance;Failover Partner=Server2'Instance;Initial Catalog=MyDb;Integrated Security=True;

我在hibernate论坛上找到了以下与此主题相关的文章:
https://forum.hibernate.org/viewtopic.php?f=25&t=979764

一位用户提到以下内容:
We had a slight hiccup with the way we were caching our NHibernate session and had to add a method that verifies the session's connection is still open when we pull it out of the call context.

NHibernate是否因为使用ADO.net而开箱即用地支持此数据库镜像选项
在使用这样的连接字符串时,有什么特殊情况需要注意吗

NHibernate w/通过连接字符串中的故障转移伙伴进行数据库镜像

它支持这一点,并在使用3.2的测试和生产系统中向自己证明了这一点。它也适用于3.3。

我唯一需要注意的是,我通过读取配置设置在页脚中显示数据库服务器。这仍然会显示数据源,并且没有找到一种简单的方法来显示故障转移伙伴是否正在使用。