NHibernate w/ database mirroring via Failover Partner in connection string

时光怂恿深爱的人放手 提交于 2020-01-05 03:47:09

问题


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;

I found the following article related to this topic in a hibernate forum:
https://forum.hibernate.org/viewtopic.php?f=25&t=979764

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.

Does NHibernate support this database mirroring option out of the box because it uses ADO.net?
Is there any special cases that I need to watch out for when using a connection string like this?


回答1:


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.



来源:https://stackoverflow.com/questions/9590756/nhibernate-w-database-mirroring-via-failover-partner-in-connection-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!