How do I set the command timeout using Massive ORM?

338 Views Asked by At

How do I set the command timeout property using Massive ORM?

1

There are 1 best solutions below

0
On BEST ANSWER

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