Trying to get child of child, both with many relationship.
So a CarePeriod has many DailyExerciseSets which has many ExerciseTrials. so carePeriod has collection of DailyExerciseSets which has a collection of ExerciseTrials SQL I would write is
SELECT <bla>
FROM careperiods
left outer JOIN DailyExerciseSets ON (...)
left outer JOIN exerciseTrials ON (...)
WHERE
careperiods.bla = bla
AND DailyExerciseSets.bla = bla
AND exerciseTrials.bla = bla
Just need to replicate this logic in EF/LINQ. I have worked around this issue a couple times but really want to see how this is meant to be accomplished.
intuitively i would have gone for
var x = (from cp in db.carePeriod
.include(cp => cp.DailyExerciseSets) //this bit is fine
.include(cp => cp.DailyExerciseSets.exerciseTrials) //fail...
where (conditions...)
select cp);
but this fails..
A point in the right direction would be great.