本文介绍了NHibernate:如何设置连接超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在NHibernate中发生连接失败(连接超时)之前,是否有任何方法可以全局等待建立连接到给定数据库的时间?在ADO.NET中,您可以为单个连接执行以下操作:
Is there any way to globally setup time you would wait for connecting to a given database, before a connection failure in NHibernate (connection timeout)? In ADO.NET you can do it for a single connection like this:
new SqlConnection().ConnectionTimeout = 10;我发现了如何设置命令执行失败之前等待结果集的时间此处(命令超时).但是,显然,这不是我所需要的
I found how to setup the time you would wait for a result set, before a command execution failure here (command timeout). But, apparently, that's not what I need
推荐答案您可以在连接字符串"Connection Timeout = x"上进行设置.
You can set it on the connection string, "Connection Timeout=x".
更多推荐
NHibernate:如何设置连接超时
发布评论