Using Entity Framework Core 2 Migrations

As you have seen, when developing applications your models might change frequently when refactoring and finalizing your projects. This might lead to a database schema that is out of sync, and which therefore needs to be updated manually by creating an upgrade script.

Fortunately, Entity Framework Core 2 includes a feature called Migrations to help you with this tedious task by automatically keeping your models and the corresponding database schemas in sync.

After you have updated the models, services and controllers to comply to the constraints from above, and have modified the Game Db Context accordingly, you are now ready to use Entity Framework Core 2 Migrations:

  1. Add a first version of your Db ...

Get Learning ASP.NET Core 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.