Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top