public static void GlowMigrateConfigurationSqlServer(this IServiceProvider serviceProvider) { using IServiceScope scope = serviceProvider.CreateScope(); SqlServerConfigurationDataContext db = scope.ServiceProvider.GetRequiredService <SqlServerConfigurationDataContext>(); db.Migrate(); }
public EfConfigurationProvider(Action <DbContextOptionsBuilder> optionsAction) { OptionsAction = optionsAction; var builder = new DbContextOptionsBuilder <SqlServerConfigurationDataContext>(); OptionsAction(builder); using var dbContext = new SqlServerConfigurationDataContext(builder.Options); dbContext.Database.Migrate(); }