O'Reilly logo

ASP.NET Core Essentials by Shahed Chowdhuri

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

EF Code First migrations for database versioning and maintenance

In EF, you can use migrations to facilitate the creation, upgrade, and downgrade of your database. You can also use the automatically generated version history to keep track of changes and stay in sync with the rest of your development team.

We have previously set up migrations in our sample project to get the ball rolling. In this section, we will add a new migration to reflect the changes we made in this chapter.

Setting up migrations

The following is a recap of how we previously set up our migrations for EF. Once again, keep in mind that your DNX version may vary:

  1. Open a command prompt to your project folder's location.
  2. Run the following commands:
>dotnet restore
>dotnet build
>dotnet ...

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