I have this code for my Data Access class where I want to load all the Patients where they some should have, Patient.Addresses, Patient.Examinations, Examinations.LeftEye, Examinations.RightEye….
How to Load all the related data with a patient? I havent managed to load even the address.
This is the current code:
db.Patients.Include("Addresses");
db.Patients.Include("Examinations");
db.Examinations.Include("LeftEyePictures");
db.Examinations.Include("RightEyePictures");
List<Patient> list = db.Patients.ToList();
list.ForEach(p => p.ChangeTracker.ChangeTrackingEnabled = true);
return list;
Thank you.
Includemust be part of the query!