Example for LINQ to Entities query with multi level relationship (grandparent / grandchild records)
Posted on 2008-11-14
Hoping there's a good LINQ coder that can help me out here. My database has a string of related tables where table B has a foreign key to table A and table C has foreign key to table B and table D has foreign key to table C. I need to write a LINQ to Entities query that looks something like:
var query = from d in entities.D where d.c.b.a.primarykey = x select d.textfield;
I don't seem to have grip on how to reach that far through the relationships to filter on a value.