Exemplo n.º 1
0
        private static async Task<IReadOnlyList<string>> RetrieveEmployeesAsync(DbConnection connection)
        {
            var result = new List<string>();

            var reader = default(DbDataReader);
            try
            {
                reader = await connection.ExecuteReaderAsync("SELECT [full_name] FROM tc_employee");
                while (await reader.ReadAsync())
                {
                    result.Add(reader.GetString(0));
                }
            }
            finally
            {
                if (reader != null) reader.Dispose();
            }

            return result;
        }