EF Core Scaffold-DbContext table 未包含在选择集中

EF Core Scaffold-DbContext table not included in the selection set

我最近升级了 to.Net Core 2.0,运行我在搭建现有数据库时遇到了很多问题。

首先,当我运行

Scaffold-DbContext "Server=mysrv;Database=mydb;User Id=uname;password=pword" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

我收到以下错误。这让我很困惑,因为我的数据库中没有 table 和 UK_principal_name 索引?

Unable to find a table in the database matching the selected table dbo.sysdiagrams.
For index PK__sysdiagrams__0CBAE877. Unable to find parent table dbo.sysdiagrams. Skipping index.
For index UK_principal_name. Unable to find parent table dbo.sysdiagrams. Skipping index.

所以我尝试像这样从数据库中指定一个 table。

Scaffold-DbContext "Server=mysrv;Database=mydb;User Id=uname;password=pword" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Table Burner

我得到了之前的错误以及这个错误。

Index column dbo.BurnerHistory belongs to index PK_BurnerHistory on table Burn_Hist_Idx which is not included in the selection set. Skipping.

table不包含在选择集中是什么意思?在以前版本的 .NET Core 上,我没有遇到这个脚手架命令的问题 运行,它会抓取我所有的 table 并在模型中为它​​们生成代码。

原来我的问题是我使用的是 SQL server 2005,并且 Scaffold-Dbcontext 在该版本上有 dbo.sysdiagrams 错误。不得不回到旧版本的 .NET。

这些不仅仅是警告,因为在我解决这个问题之前我无法构建我的模型。