public DbCommand CreateCommand(DbConnection connection, DbTransaction transaction, string statement, CommandParameterValues args, ITypeHandlerRegistry typeHandlers, DocumentMap mapping = null, TimeSpan?commandTimeout = null) { var command = connection.CreateCommand(); try { command.CommandTimeout = (int)(commandTimeout ?? DefaultCommandTimeout).TotalSeconds; command.CommandText = statement; command.Transaction = transaction; args?.ContributeTo(command, typeHandlers, mapping); return(command); } catch { command.Dispose(); throw; } }
public IDbCommand CreateCommand(IDbConnection connection, IDbTransaction transaction, string statement, CommandParameterValues args, DocumentMap mapping = null, int?commandTimeoutSeconds = null) { var command = connection.CreateCommand(); try { command.CommandTimeout = commandTimeoutSeconds ?? DefaultCommandTimeoutSeconds; command.CommandText = statement; command.Transaction = transaction; args?.ContributeTo(command, mapping); return(command); } catch { command.Dispose(); throw; } }