@manhnguyenv

Welcome to my blog!

EF Core

September 18, 2017 11:15

Getting Started With Entity Framework Core - Console

http://www.learnentityframeworkcore.com/walkthroughs/console-application

Step 1) Creating a .Net Core Console application

Step 2) Creating A Model

Step 3) Adding A Migration
dotnet ef migrations add CreateDatabase
dotnet ef database update

Step 4) Modifying The Database With Migrations
dotnet ef migrations add LimitStrings
dotnet ef database update

How to use the "dotnet ef migrations ..."

<Project Sdk="Microsoft.NET.Sdk.Web">
    ...
        <ItemGroup>
        ...
        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" />
    </ItemGroup>
    <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
    ...
</Project>

 

Categories

Recent posts