Blog: Entity Framework Migrations

Automatically migrate your Entity Framework Core managed database on ASP.NET Core application start

March 20, 2018, (updated on September 20, 2018), 2 comments, Software Development

If you use Entity Framework Core with migrations in your ASP.NET Core application and want to ensure that the database structure always matches the currently running application, you can simply migrate the database on application startup. This way you just have to redeploy your application and everything like migrating the data, change the schemas, etc. is done when the application is restarted. To do an automatic migration, register your DbContext implementation in the ASP.NET Core’s dependency injection system – the same way as it is already recommended by Microsoft. Because there is no active injection scope in the Configure() method, […] Read more...

Tags: , , ,

  Page 1 of 1