官方 ASP.Net Core 表示,以下错误可通过重新启动 Visual Studio 来解决:
Scaffold-DbContext : The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
但是该命令一直无法执行。
我按照 ASP.Net Core 在线文档提供的示例,在程序包管理器控制台中运行它。
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models