需要引用如下nuget包
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer.Design
控制台执行命令
Scaffold-dbcontext "Server=.;Database=****;User ID=****;Password=****;Trusted_Connection=True;MultipleActiveResultSets=true;Encrypt=false;" Microsoft.EntityFrameworkCore.SqlServer -outputdir Models
更新命令:Scaffold-dbcontext "Server=.;Database=****;User ID=****;Password=****;Trusted_Connection=True;MultipleActiveResultSets=true;Encrypt=false;" Microsoft.EntityFrameworkCore.SqlServer -outputdir Models -Force