Esempio n. 1
0
        public virtual async Task <IReadOnlyList <HistoryRow> > GetAppliedMigrationsAsync(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var rows = new List <HistoryRow>();

            if (await ExistsAsync(cancellationToken))
            {
                await _connection.OpenAsync(cancellationToken);

                try
                {
                    using (var reader = await _executor.ExecuteReaderAsync(_connection, GetAppliedMigrationsSql, cancellationToken))
                    {
                        while (await reader.ReadAsync(cancellationToken))
                        {
                            rows.Add(new HistoryRow(reader.GetString(0), reader.GetString(1)));
                        }
                    }
                }
                finally
                {
                    _connection.Close();
                }
            }

            return(rows);
        }