O'Reilly logo

ASP.NET Core: Cloud-ready, Enterprise Web Application Development by James Singleton, Valerio De Sanctis, Mugilan T. S. Ragupathi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating the database

It's time to create a new migration and reflect the code changes to the database by taking advantage of the code-first approach we chose in Chapter 4, The Data Model.

It's worth noting that if we were using Entity Framework 6, we could entirely skip this step by implementing the auto-migration feature it used to have. Unfortunately, there's no such thing in EF core, so we must add our migrations manually.

Let's open a Powershell command prompt and go to our project's root folder, then write the following:

> dotnet ef migrations add "Identity" –o "Data\Migrations"

A new migration will be added to the project. Right after that, we could choose to update our database...except it won't be a good idea. Applying the new migration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required