سؤال

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

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top