Database Migration

We have created the business entity—the Employee class. Now, we can proceed with the migration. Migration is a two-step process: in the first step, we create the migration files. We have seen how to create migrations from the Package Manager Console. There is also one other way to create migrations from command-line tools. To do it, first we need to edit the MVCEF.csproj project file and add tools to the end of the file. So your project file's ending should look like this:

...  <ItemGroup>    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools"    Version="2.0.0-preview2-final" />    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"    Version="2.0.0-preview2-final" /> </ItemGroup> ...

Get ASP.NET Core 2 Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.