这是示例模型类,与 Entity Framework Code First 一起使用:
public class Master
{
public int Id { get; set; }
public Collection<Detail> Details { get; set; }
}
public class Detail
{
public int Id { get; set; }
public Master Master { get; set; }
public SubDetail SubDetail1 { get; set; }
public SubDetail SubDetail2 { get; set; }
}
public class SubDetail
{
public int Id { get; set; }
}
我想Master
明确加载它的所有细节和子细节。要加载我正在使用的详细信息Include
:
context.Masters.Include("Details").Where(master => master.Id == 1);
我应该使用什么来加载子详细信息?