Set TimeOut Expired in NHibernate
Asked Answered
A

1

6

I have a stored procedure in sql server 2008 R2 which was working fine, but suddenly it throws an exception of TimeOut Expiration.

BmDaoSession.CreateSQLQuery("exec SP_Name @Param1  = '" + clientCode + "', @Param2 ='" + existingDatabase + "', @Flag='" + flag + "'").ExecuteUpdate();

I am using the above NHibernate command to call my SP.

My question is how Can I set the TimeOut Expiration in NHibernate. Thanks

Aker answered 15/4, 2014 at 10:55 Comment(0)
L
9

Just add fluently SetTimeout method:

BmDaoSession.CreateSQLQuery("exec SP_Name @Param1  = '" + clientCode + "', @Param2 ='" + existingDatabase + "', @Flag='" + flag + "'")
    .SetTimeout(120)
    .ExecuteUpdate();

For more information you can read here.

Literalminded answered 15/4, 2014 at 15:34 Comment(1)
Please note the error. .SetTimeOut should be .SetTimeout in the code.Automat

© 2022 - 2024 — McMap. All rights reserved.