gpt4 book ai didi

c# - Principal Role App 引用的属性必须与 EntityType 的键完全相同

转载 作者:可可西里 更新时间:2023-11-01 08:39:44 24 4
gpt4 key购买 nike

我首先使用 EF DB。

我做了一个观点。

将其映射到 EF。

现在我得到以下错误:

Error 2 Error 111: Properties referred by the Principal Role App must be exactly identical to the key of the EntityType MaMDBModel.App referred to by the Principal Role in the relationship constraint for Relationship MaMDBModel.FK_AppsData_App. Make sure all the key properties are specified in the Principal Role. D:\MaM\Dev\MamAdmin_1.0\MaMDBEntityFramework\MaMModel.edmx 768 11 MaMDBEntityFramework

这是我的 edmx:

http://ge.tt/3rRWTOR/v/0?c

最佳答案

在您的 edmx 文件中有一条错误消息作为注释:

<!--Errors Found During Generation:
warning 6002: The table/view 'MamDB.dbo.VW_APPSDATA' does not have a primary key
defined. The key has been inferred and the definition was created as a read-only
table/view.
-->

EF 推断出的 key 可能是错误的。根据消息,您应该为数据库中的 View 定义一个主键。

关于c# - Principal Role App 引用的属性必须与 EntityType 的键完全相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13331531/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com