0

I have table A, B , C, D, E, F with the relationship
A(parent) --> B ---> C (Part A) A(parent) --> D --> E -- > F (Part B)

I'd refer the link below to get my answer but I am only able to get till E part B. I couldn't get until F

Click here!

Here is my code:

var query = db.tableA.Include(c => c.tableB.Select(b => b.tableC))                                                                                 
           .Include(d => d.tableD.Select(e => e.tableE));
Community
  • 1
  • 1
Brian Lee
  • 33
  • 6

1 Answers1

0

It one tableE can have collection of tableF then you just need to add another select:

var query = db.tableA.Include(c => c.tableB.Select(b => b.tableC))
        .Include(d => d.tableD.Select(e => e.tableE.Select(m => m.tableF)));

If one tableE can have one tableF then you should write it as below:

var query = db.tableA.Include(c => c.tableB.Select(b => b.tableC))
        .Include(d => d.tableD.Select(e => e.tableE.tableF));
Adil Mammadov
  • 8,476
  • 4
  • 31
  • 59