protected virtual IDbExecuteContext Execute(MySqlCommand command, IDbTracing tracing) { try { TryExecuteTracing(tracing, t => t.OnExecuting(command)); var connection = new MySqlConnection(ConnectionString); connection.Open(); command.Connection = connection; if (Configuration.QueryExecutingTimeout.HasValue) { command.CommandTimeout = (int)Configuration.QueryExecutingTimeout.Value.TotalSeconds; } var context = new MySqlExecuteContext(connection, command.ExecuteReader(), tracing); TryExecuteTracing(tracing, t => t.OnLoadingData(context)); return(context); } catch (DbException exception) { TryExecuteTracing(tracing, t => t.OnException(exception)); throw; } }
protected override IDbExecuteContext Execute(MySqlCommand command, IDbTracing tracing) { TryExecuteTracing(tracing, t => t.OnExecuting(command)); command.Connection = _transaction.Connection; command.Transaction = _transaction.Transaction; if (Configuration.QueryExecutingTimeout.HasValue) { command.CommandTimeout = (int)Configuration.QueryExecutingTimeout.Value.TotalSeconds; } var dataReader = command.ExecuteReader(); var context = new MySqlExecuteContext(_transaction, dataReader, tracing); TryExecuteTracing(tracing, t => t.OnLoadingData(context)); return(context); }