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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.