【发布时间】:2009-01-24 14:51:13
【问题描述】:
我有三个表:场景、组件和块。 Blocks 有一个指向 ComponentId 的外键,Components 有一个指向 Scenarios 的外键。
Blocks 也有一个指向另一个表 TreeStructures 的外键 (TreeStructureId)。
现在,为什么会这样:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("TreeStructures").Include("Components.Scenarios");
它加载树结构、组件和场景。
但这不起作用:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("Components.Scenarios").Include("TreeStructures");
这会加载组件和场景,但不会加载 TreeStructures...
我觉得很奇怪……这是为什么?
谢谢,利文·卡登
【问题讨论】:
-
您是否尝试通过使用北风数据库加载干净的 edmx 来重现该问题?
-
好像我不知道为什么解决了这个问题。大概做了什么傻事吧。谢谢。
标签: c# entity-framework include objectquery