NHibernate w/通过连接字符串中的故障转移伙伴进行数据库镜像 [英] NHibernate w/ database mirroring via Failover Partner in connection string
问题描述
我将以说我正在使用NHibernate v3.2
作为开头.
假设我有一个类似于以下的连接字符串(这里的键是Failover Partner
):
I'll preface this question by saying I am using NHibernate v3.2
.
Let's say I have a connection string like the following (the key here is the 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
I found the following article related to this topic in a hibernate
forum:
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.
One user mentions the following:
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而开箱即用地支持此数据库镜像选项?
使用这样的连接字符串时是否需要注意某些特殊情况?
推荐答案
它支持此功能,并已在使用3.2的测试和生产系统中向我证明了这一点.在3.3中也可以正常使用.
It supports this and have proven this to myself in both test and production systems using 3.2. It also works fine with 3.3.
我唯一需要看的就是通过阅读配置设置在页脚中显示数据库服务器.如果正在使用故障转移伙伴,它将仍然显示数据源,并且找不到一种简单的方法来显示.
The only thing I had to watch was that I display the database server in the footer by reading configuration settings. This will still display data source and have not found an easy way to display if Failover partner is in use.
这篇关于NHibernate w/通过连接字符串中的故障转移伙伴进行数据库镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!