第一个错误:

EntityFramework错误:Unable to update the EntitySet because it has a DefiningQuery

原因:表中没有主键,添加一个主键,即可。

EF Unable to update the EntitySet because it has a DefiningQuery 未经处理的异常: System.Data.Entity.Infras

第二个错误:

未经处理的异常: System.Data.Entity.Infrastructure.DbUpdateException: 更新条目时出错。有关详细信息,请参阅内部异常。 ---> System.Data.Entity.Core.UpdateException: 更新条目时出错。有关详细信息,请参阅内部异常。 ---> System.Data.SqlClient.SqlException: 违反了 PRIMARY KEY 约束“PK_Posts”。不能在对象“dbo.Posts”中插入重复键。重复键值为 (1)。

EF Unable to update the EntitySet because it has a DefiningQuery 未经处理的异常: System.Data.Entity.Infras

相关文章:

  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-09-23
猜你喜欢
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2021-09-03
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案