[英]EntityFramework in .net6 "no entity type mapped to the table"
我已将代码从 .net3.1 升级到 .net6,现在当我尝试从头开始重建数据库时,出现此错误:
但正如您在同一张图片中看到的那样,有一个实体配置为使用该表!
迁移中失败的代码只是插入了一些数据:
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
schema: "dbo",
table: "PlannerGroup",
columns: new[] { "PlannerGroupId", "PlannerGroupName", "Position" },
values: new object[,]
{
{ 30, "Bread", 31 },
{ 31, "Drinks", 32 }
});
}
如何修复此错误?
如何在操作中指定类型或列类型?
在我的场景中,解决方案是删除“模式:”dbo”,参数。只有这个工作:
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "PlannerGroup",
columns: new[] { "PlannerGroupId", "PlannerGroupName", "Position" },
values: new object[,]
{
{ 30, "Bread", 31 },
{ 31, "Drinks", 32 }
});
}
我想.net6 非常不喜欢冗余的 arguments ......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.