Running migration

Running .NET CLI commands is straightforward. There are various commands that helps you with adding migration, removing migration, updating the database, dropping the database, and so on.

Let's start by creating the initial migration first. To create the initial migration, you have to go to the root folder path of your data access layer project and run the following:

dotnet ef migrations add Initial 

In the preceding command, Initial is the name of the migration. When the command is executed, it actually searches for the class derived from the DbContext base class, and creates the database and tables for the connection string defined. Otherwise, the local DB store will be used.

On running, a new Migrations folder is created ...

Get Enterprise Application Architecture with .NET Core 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.