visual-studio-2010 - 具有继承、条件和外键的 Entity Framework

标签 visual-studio-2010 entity-framework entity-framework-4

我刚刚开始使用 Linq to entity 并遇到了一个我无法弄清楚的问题。

我收到此错误:

Condition member 'RelatedResources.TypeID' with a condition other than 'IsNull=False' is mapped. Either remove the condition on RelatedResources.TypeID or remove it from the mapping.



存在的条件是抽象实体RelatedResource 中的TypeID 字段,它定义了RelatedResource 的类型(书籍、链接、指南等)。 TypeID 也是一个外键,并在与资源类型实体的关联中映射。我认为这是问题所在,但我不知道我应该如何或为什么要改变这一点。

最佳答案

当您将 TypeID 作为条件并将其用作属性时,通常会发生这种情况。它可能会导致问题,因为您使用它来映射与 ResourceType 的关联并将其用作继承的条件。

关于visual-studio-2010 - 具有继承、条件和外键的 Entity Framework ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2200906/

相关文章:

asp.net - 我是否应该对映射表使用复合键,该复合键也用于外键?

sql - 如何在 C# 中的 codefirst 技术中使用带有 EF 的 Linq 避免 SQL 注入(inject)

c++ - 为什么我会出现内存泄漏?

visual-studio-2010 - C++/CLI串口发送命令

mysql - SQL order by < linq to entity framework 中的字符串

entity-framework - LINQ 到实体 4 : Query with calculation in where clause

entity-framework-4 - 在 Entity Framework 4 中使用 Moq

linq - 如果您使用实体投影,您会获得 IQueryable 的好处吗?

c++ - 常量字段中的初始化列表不生成 operator=

c# - Visual Studio 2010 不会在 Socket.BeginReceive() 回调中出现未处理的异常时停止 - 为什么?