gpt4 book ai didi

c# - Entity Framework : Eager Loading Navigation Properties of Inherited Entities

转载 作者:太空狗 更新时间:2023-10-29 17:57:36 24 4
gpt4 key购买 nike

我正在尝试加载我的整个图表,它看起来像下面这样:

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");

显然,并非所有 Schedule.DaysTrainingDay s,所以由于包含 Exercises 的路径,我收到运行时错误.

我是否缺少此处的配置,或者我是否需要求助于延迟加载(我希望不需要)。

谢谢

最佳答案

看起来很多开发者都为这个问题感到痛苦,包括我。

Please cast your vote!!!

关于c# - Entity Framework : Eager Loading Navigation Properties of Inherited Entities,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7271374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com