如果我有下面的类模型...EF 4.1,代码优先:从数据库级联集合预先加载
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
和所有依赖的对象在内存中一个单独的数据库查询?
我在meta上开始了这个问题:http://meta.stackexchange.com/questions/85358/how-to-use-version-specific-tags它与我们以前关于EF中版本特定标记的通信有关。 – 2011-03-30 19:30:36
@拉迪斯拉夫:好的,我会看这个。让我们看看退伍军人是怎么想的。 – Slauma 2011-03-30 20:05:14