When you have finished defining your EF model the first time and you want to create the actual database and tables. First you will need to install the EF Core command line tools, you can do this in the .NET Core CLI or inside Visual Studio. But this post I will be focusing on Visual Studio only. So open your Package Manager Console and enter the following commands.

Install-Package Microsoft.EntityFrameworkCore.Tools

The Install-Package command will install the command tools for you, before you can continue to the next command.

Add-Migration InitialCreate

Add-Migration command will create the migration to generate the initial sets of tables for the model.

Update-Database

Update-Database command will create the database and applies the new migration to it.

Shares