1. 創建基於.net core 的項目(過程略)
2. 使用nuget添加引用
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.SqlServer.Design

3. 在程序包管理器控制台執行語句
Scaffold-DbContext "Server=***;User Id=***;Password=***;Database=***;Persist Security Info=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -f
注意:
要選中默認項目
-o 后面指定文件夾,
-f 表示是否覆蓋原文件
-t 后面跟表名

