IEnumerable <object[]> LoadData(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 = executor.ExecuteDebug(sql, BuildParameters(args), SelectColumns)) results = reader.GetRows().Enumerate(); if (!string.IsNullOrWhiteSpace(teardown)) { executor.ExecuteCommand(teardown, CodingConstants.Empty.StringObject); } if (logger.CanLogInfo(LogMessages.ExecutedQuery)) { logger.LogInfo($"Executed sql in {timer.SplitString()}", LogMessages.ExecutedQuery); } return(results); }