gpt4 book ai didi

asp.net-mvc - 概念类型中的成员数量不匹配 - 但确实匹配

转载 作者:行者123 更新时间:2023-12-03 23:45:15 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Number of members in conceptual type does not match with number of members on object side type

(9 个回答)


去年关闭。




我突然开始在 .NET 4 MVC 项目中收到以下错误。

The number of members in the conceptual type 'OrnaviModel.Task' does not match with the number of members on the object side type 'Ornavi.Core.Objects.Task'. Make sure the number of members are the same.



该项目使用 EDMX 文件,该文件用于生成所需的数据对象。该项目上周运行良好,但是现在每当我向任何实体添加新字段时都会出现此错误。删除新属性会立即修复错误。

该字段也已添加到基础数据库表中,因此不应存在不匹配。

为什么我的文件突然停止正确生成?我试过“运行自定义工具”,但无济于事。我在单独的 PC 上尝试过,没有任何乐趣。如果我以 XML 模式打开 EDMX 文件,我可以看到新属性在那里,同样如果我浏览到生成的类,属性就在那里。

请帮忙..这让我发疯了!

编辑:我仍然没有得到答案,所以我将发布一些屏幕截图以查看是否有帮助:

我修改了 Tasks 表,如下所示:

enter image description here

然后单击“从模型生成数据库”以刷新底层对象。如果我展开 DataModel.edmx 文件,并浏览到相关类,我可以看到新字段:

enter image description here

我也将该列添加到数据库中,但每次访问该页面时:

The number of members in the conceptual type 'OrnaviModel.Task' does not match with the number of members on the object side type 'Ornavi.Core.Objects.Task'. Make sure the number of members are the same.



为什么会出现这种情况?

我尝试了以下方法:
- 在 edmx 上运行自定义工具
- 在不同的计算机上进行更改
- 尝试了不同的表、列、变量类型

笔记本电脑上没有任何变化 - 相同版本的 Visual Studio,没有安装更新。

每次都是同样的问题。如果我删除该列,请单击“从模型生成数据库”,然后它就可以正常工作了。重新添加,同样的问题。

请帮忙!这个项目的数据库结构非常庞大,所以我真的不想重新创建整个事情!

enter image description here

最佳答案

可能是您在不同项目中有两个版本的模型,例如此评论中提到的类似问题的解决方案:

Number of members in conceptual type does not match with number of members on object side type

关于asp.net-mvc - 概念类型中的成员数量不匹配 - 但确实匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49067755/

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