Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created November 6, 2019 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/2483582129bca949ef107bdf352b2e87 to your computer and use it in GitHub Desktop.
Save IntegerMan/2483582129bca949ef107bdf352b2e87 to your computer and use it in GitHub Desktop.
private static void ApplyDatabaseMigrations(IApplicationBuilder app)
{
using var scope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope();
scope.ServiceProvider.GetRequiredService<ApplicationDbContext>().Database.Migrate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment