我发现自从NHibernate 5.0我可以调用以下代码来删除表的所有记录:
session.Query<T>().Delete();
它执行数据库上的代码而不通过网络复制它,这应该会大大提高性能。 但是这个查询超时了。
我收到以下错误:
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
我尝试将我的connectionstring中的连接超时设置设置为0和3600,但没有区别。
我的表只有大约200条记录。但是一列是base64编码的pdf,所以它很大,查询需要几秒钟。
我还能尝试什么?
答案 0 :(得分:0)
听起来你需要增加命令超时。
请注意connection timeout and command timeout之间存在差异。
您可以使用command_timeout NHibernate会话配置属性为NHibernate创建的ADO.NET命令设置默认命令超时(以秒为单位)。根据您用于配置NHibernate的方法,有多种方法可以做到这一点。以下是基础知识:http://nhibernate.info/doc/nhibernate-reference/session-configuration.html