Adding the Initial Migration

Open a PowerShell Command Prompt and navigate through the project’s root folder, which is as follows in our example:

C:\Projects\TestMakerFree\TestMakerFreeWebApp\

Once there, type the following command to add the first migration:

dotnet ef migrations add "Initial" -o "Data\Migrations"

The optional -o parameter can be used to change the location where the migration code-generated files will be created; if we don’t specify it, a root-level /Migrations/ folder will be created and used as default. Since we put all the EntityFrameworkCore classes into the /Data/ folder, it’s advisable to store migrations there as well.

The command should give the on-screen output below:

Wait for the migration to be created, and ...

Get ASP.NET Core 2 and Angular 5 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.