Hello,
I have the following command:
var query = from x in context.FirstTable.Include("SecondTable")
where x.TestColumn == 5 &&
x.SecondTable.SecondTestColumn == 3
select x;
Now I also want to load the entries from a third table named "ThirdTable". But I can only reference it via the SecondTable table. There is a foreign key from FirstTable to SecondTable and one from SecondTable to ThirdTable, but none from FirstTable to ThirdTable.
using the following query was not possible. The exception was that it can not navigate from FirstTable to ThirdTable:
var query = from x in context.FirstTable.Include("SecondTable").Include("ThirdTable")
where x.TestColumn == 5 &&
x.SecondTable.SecondTestColumn == 3
select x;
Or will I need to do an additional query on ThirdTable for every resultset I get back from that query?
Thank you very much in advance!
Craig Stuntz:
I have the following foreign keys: table1 <-> table2 <-> table3
let's say the tables are the following way: orders <-> customers <-> customer_preferences
So I have no need to make a foreign key from orders to customer_preferences.
It would be unnecessary most of the time. Just this time i want to safe some extra database roundtrips.