async Task <IEnumerable <object[]> > LoadDataAsync(IExecutor executor, TArgs args, ILogger logger) { var(sql, teardown) = BuildSql(args); if (logger.CanLogInfo(LogMessages.ExecutingQuery)) { logger.LogInfo($"Executing sql:{Environment.NewLine}{sql}", LogMessages.ExecutingQuery); } var timer = new Timer(true); // execute and get all rows IEnumerable <object[]> results; using (var reader = await executor .ExecuteDebugAsync(sql, BuildParameters(args), SelectColumns) .ConfigureAwait(false)) { results = await reader .GetRowsAsync() .ConfigureAwait(false); results = results.Enumerate(); } // TODO: try catch to give any exceptions some context if (!string.IsNullOrWhiteSpace(teardown)) { await executor .ExecuteCommandAsync(teardown, CodingConstants.Empty.StringObject) .ConfigureAwait(false); } if (logger.CanLogInfo(LogMessages.ExecutedQuery)) { logger.LogInfo($"Executed sql in {timer.SplitString()}", LogMessages.ExecutedQuery); } return(results); }