如果我有以下班级模型......
public class A
{
public int AId { get; set; }
public ICollection<B> BCollection { get; set; }
}
public class B
{
public int BId { get; set; }
public ICollection<C> CCollection { get; set; }
}
public class C
{
public int CId { get; set; }
}
...是否可以A
从包含所有级联集合的数据库中急切加载类型的对象?
我可以包括BCollection
这样的:
A a = context.ASet.Where(x => x.AId == 1)
.Include(x => x.BCollection)
.FirstOrDefault();
我是否还可以以某种方式包含CCollection
所有加载的B
对象,以便A
通过单个数据库查询获得内存中的所有依赖对象?