Entity Framework Core migrations
Now that we’ve configured Entity Framework and defined our application-specific DbContext
subclass, we can use the Entity Framework Core design tools to generate the physical database and create the database structure snapshot that’s needed by Entity Framework Core to interact with the database.
Entity Framework Core design tools must be installed in each project that needs them as NuGet packages. There are two equivalent options:
- Tools that work in any operating system console: These are available through the
Microsoft.EntityFrameworkCore.Design
NuGet package. All Entity Framework Core commands are indotnet ef .....
format since they are contained in theef
command line’s .NET Core application. - Tools that are specific to the Visual Studio Package Manager Console: These are contained in the
Microsoft.EntityFrameworkCore.Tools
NuGet package. They don’t need thedotnet ef
prefix since they can only be...