Computer Magic Logo
Add Migration

Saturday, December 10, 2016

Published by Aristotelis Pitaridis

When we make changes to the entity framework, models we can use the package manager console to generate a new migration class for the changes that we have done. First of all we have to open the package manager console by opening the Tools menu and we select the 'Package Manager Console' from the 'NuGet Package Manager' submenu. After that we type the following command in the package manager console.

Add-Migration [migration name]

The migration name will be used as a class name so we have to type a valid value. An example of such a name is the following

Add-Migration AddedStudentsModel

This will have as a result a new class to be generated in the ~/Data/Migrations folder.