如何在NHibernate中全局设置超时 [英] how to globally set timeout in nhibernate

查看:87
本文介绍了如何在NHibernate中全局设置超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定期收到以下异常.

I periodically receive the following exception.

System.Data.SqlClient.SqlException:超时已过期.超时时间 操作完成之前经过的时间或服务器为 没有回应.

System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

我在标准中添加了以下内容,以增加超时时间.

I've added the following to my criteria to increase the timeout time.

 .SetTimeout(180)

1)是否可以将其添加到我的nhibernate配置中,以使默认时间为180?

1) Is there a way to add this to my nhibernate configuration so that 180 is the default time?

2)增加超时有什么后果?这会增加还是减少可能造成的僵局?

2) what are the consequences to increase the timeout? Will this increase or decrease the likely hood of deadlocks?

推荐答案

command_timeout-指定NHibernate生成的IDbCommand的默认超时时间

command_timeout - Specify the default timeout of IDbCommands generated by NHibernate

取自表3.1. NHibernate ADO.NET属性在
http://www.nhforge.org/doc/nh/en /index.html#configuration-hibernatejdbc

Taken from Table 3.1. NHibernate ADO.NET Properties in
http://www.nhforge.org/doc/nh/en/index.html#configuration-hibernatejdbc

这篇关于如何在NHibernate中全局设置超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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