-
Book Overview & Buying
-
Table Of Contents
Hands-On Full-Stack Web Development with ASP.NET Core
By :
EF Core allows you to create and modify the database and its schema from your code. To enable this feature, EF Core maintains the database structure, and the changes between each schema version, in classes that are generated by the EF Core Tools. After an instance of your DbContext is created, you can instruct it to migrate to the newest schema version.
To enable EF Core migrations in your application, you need to install the EF Core Tools by adding the Microsoft.EntityFrameworkCore.Tools NuGet package if it's not already installed (if you're using the Microsoft.AspNetCore.All meta-package, then you already have it installed).
Every time your model changes, you need to add a new migration to your project. Follow these steps to learn how to do this::
Tools | NuGet Package Manager | Package Manager Console).Add-Migration [Migration Name] -p [Project Name...