How do I set the command timeout using Massive ORM?
-
27-10-2019 - |
Pergunta
How do I set the command timeout property using Massive ORM?
Solução
Massive uses the System.Data.SqlClient to connect to SQL Server directly.
In order to change timeouts you have to look into that documentation.
I modified the original CreateCommand
All I did was add result.CommandTimeout on the second line
DbCommand CreateCommand(string sql, DbConnection conn, params object[] args)
{
var result = _factory.CreateCommand();
result.CommandTimeout = 45;
result.Connection = conn;
result.CommandText = sql;
if (args.Length > 0)
result.AddParams(args);
return result;
}
default is 30 seconds...
similar thing can be done in OpenConnection with ConnectionTimeout
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow