I have 3 tables in a database (picture below). I am trying to join the tables so I can get all the related information from all the tables. I am starting at DAT_Demo and I have been able to get all the records from DAT_Demo and ARC_Records, but I cannot figure out how to also pull in all the DAT_OrderDoctors records associated with ARC_Records. I have the following code that pulls the records I want but DAT_OrderDoctors is not available. How can i do this?
Code so far:
IQueryable<DAT_Demo> query = _localContext.DAT_Demo
.Include("ARC_Records")
.Include("ARC_Immuno")
.OrderBy(d => d.LastName)
.Where(d => SqlFunctions.PatIndex(txtSearch.Text + "%", d.FirstName + " " + d.LastName) > 0)
.Take(100);
demo = query.ToList();

I think you are after a second level include
.Include("ARC_Records.DAT_OrderDoctor")
or
.Include(d=>d.ARC_Records.Secect(a=>a.DAT_OrderDoctor))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With