private static async Task ApplyDbMigrationsWithDataSeedAsync(string[] args, IConfigurationRoot configuration, IHost host) { bool.TryParse(configuration.GetSection("SeedConfiguration:ApplySeed").Value, out var applySeed); bool.TryParse(configuration.GetSection("DatabaseMigrationsConfiguration:ApplyDatabaseMigrations").Value, out var applyDatabaseMigrations); await DbMigrationHelpers .ApplyDbMigrationsWithDataSeedAsync <CoreDbContext>(host, applySeed, applyDatabaseMigrations); }
private static async Task ApplyDbMigrationsWithDataSeedAsync(string[] args, IConfiguration configuration, IHost host) { var applyDbMigrationWithDataSeedFromProgramArguments = args.Any(x => x == SeedArgs); if (applyDbMigrationWithDataSeedFromProgramArguments) { args = args.Except(new[] { SeedArgs }).ToArray(); } var seedConfiguration = configuration.GetSection(nameof(SeedConfiguration)).Get <SeedConfiguration>(); var databaseMigrationsConfiguration = configuration.GetSection(nameof(DatabaseMigrationsConfiguration)) .Get <DatabaseMigrationsConfiguration>(); await DbMigrationHelpers .ApplyDbMigrationsWithDataSeedAsync <IdentityServerConfigurationDbContext, AdminIdentityDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext, UserIdentity, UserIdentityRole>(host, applyDbMigrationWithDataSeedFromProgramArguments, seedConfiguration, databaseMigrationsConfiguration); }