I am trying to eager load my entire graph and it looks like the following:
public class WorkoutProgram
{
public Schedule Schedule { get; set; }开发者_如何学C
}
public class Schedule
{
public ICollection<DayBase> Days { get; set; }
}
public abstract class DayBase
{
}
public class TrainingDay : DayBase
{
public ICollection<Exercise> Exercises { get; set; }
}
context.WorkoutPrograms.Include("Schedule.Days.Exercises");
Obviously, not all Schedule.Days
are TrainingDay
s, so I get a runtime error because of the path including Exercises
.
Am I missing a configuration here, or do I need to resort to lazy loading (which I hope not).
Thanks
Looks like many developers are having pain of this issue, including me.
精彩评论