gpt4 book ai didi

c# - 从一个基类继承两个类给出错误 3024

转载 作者:太空狗 更新时间:2023-10-30 01:25:11 25 4
gpt4 key购买 nike

我的数据库中有三个表 t1、t2 和 t3,t1 是 t2 和 t3 的“基础”。每个表都有一个名为 Id 的列,t2 和 t3 也有一个名为 t1Id 的列。

t1.t1Id 和 t2.t1Id/t3.t1Id 上也有外键约束,基数为 1 到 0..1。

在 VisualStudio EF-Modeldesigner 中,我生成了以下情况:

Basic picture of the situation

确实有更多的专栏,但它们与我的问题无关;-)。在编译过程中,我遇到了两个错误代码 3024 的错误:

   Problem in mapping fragments starting at line xy: Must specify mapping for all key properties t1.t1Id of the EntitySet t1s

编辑:我使用 POCO-Classes

我看不出问题出在哪里。我尝试通过添加 ForeignKey-association 和 navigation-properties 来解决问题,但没有成功。

最佳答案

您不应该将 t1id 添加到派生类型,t1id 隐含在派生类型中。

要重建映射,请按“从模型生成数据库”

编辑:将 t1id 仅放在 t1 上,而不放在 T2 和 T3 上

关于c# - 从一个基类继承两个类给出错误 3024,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7486223/

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