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

Craig Stuntz
  • 125,891
  • 12
  • 252
  • 273
Lieven Cardoen
  • 25,140
  • 52
  • 153
  • 244

1 Answers1

0

Did you properly set the relations between the entities in your logical model? Is it set up in a way that allows navigation from Scenarios s to TreeStructures? Having a foreign key is not enough afaik.

driAn
  • 3,245
  • 4
  • 41
  • 57
  • Yes, it is set, otherwise I guess the first example of code wouldn't work either. That's the strange thing you see. It's like the order of the Include matters... – Lieven Cardoen Jan 25 '09 at 18:40