NHibernate:如何设置连接超时 [英] NHibernate: how to set connection timeout

查看:426
本文介绍了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:如何设置连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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