This article
4.1 Open cmd, execute: dotnet tool install --global dotnet-ef version as too low Enter: dotnet tool install --global dotnet-ef
4.2. Install the latest .NET Core SDK 3.0
4.3 cd D:. \ Work \ project folder (directory into the project), install the EF Design dotnet add package Microsoft.EntityFrameworkCore.Design
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
4.4. Verification tool is already installed
dotnet restore
dotnet ef
_/\__
---==/ \\
___ ___ |. \|\
| __|| __| | ) \\\
| _| | _| \_/ | //|\\
|___||_| / \\\/\\
Entity Framework Core .NET Command-line Tools 3.1.0
4.5. The first execution (new migrations)
dotnet ef migrations add initial
Build started... Build succeeded. Done. To undo this action, use 'ef migrations remove'
4.6. When there is a change model, execute change task dotnet ef migrations add testTable
And then run the program can automatically synchronize the data structure of data to initialize see MigrateHostedService.cs, can also be performed dotnet ef database update, synchronized to the database