I am trying to eager load my entire graph and it looks like the following:
public class WorkoutProgram
{
public Schedule Schedule { get; set; }
}
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.
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