private async Task Migrate(MigrationContext context, IEnumerable <Type> migrations, Func <IMigration, Task> action) { foreach (var migration in migrations.Select(type => CreateInstance(type, context))) { using (_logger.Scope("Execute migration: " + migration.GetType().Name)) { await Migrate(migration, action); } } }
private void Migrate(MigrationContext context, Action <IMigration> action) { var migrations = GetMigrations(context); foreach (var migration in migrations.Select(type => CreateInstance(type, context))) { using (_logger.Scope("Execute migration: " + migration.GetType().Name)) { action(migration); } var disposable = migration as IDisposable; disposable?.Dispose(); } }