2

I have three tables: Scenarios, Components and Blocks. Blocks has a foreign key to ComponentId and Components has a foreign key to Scenarios.

Blocks also has a foreign key (TreeStructureId) to another table TreeStructures.

Now, why does this work:

ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("TreeStructures").Include("Components.Scenarios");

It loads the TreeStructures, Components and Scenarios.

This however doesn't work:

ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("Components.Scenarios").Include("TreeStructures");

This loads the Components and Scenarios but doesn't load the TreeStructures...

Seems very strange to me... Why is this?

thx, Lieven Cardoen

4

1 回答 1

0

您是否正确设置了逻辑模型中实体之间的关系?它是否以允许从 Scenarios 导航到 TreeStructures 的方式设置?拥有外键是不够的。

于 2009-01-24T15:29:02.657 回答