4
Sample類結構預先加載包括派生類
class Order
{
public int Id { get; set; }
public DateTime Date { get; set; }
public List<OrderDetail> Details { get; set; }
}
class OrderDetail
{
public int Id { get; set; }
public int Qty { get; set; }
public Item Item { get; set; }
}
class Item
{
public int Id { get; set; }
public string Name { get; set; }
}
class ElectronicItem : Item
{
public MoreDetail Detail { get; set; }
}
class MoreDetail
{
public int Id { get; set; }
public string SomeData { get; set; }
}
的導航屬性爲了填充順序的對象與所有的導航屬性,我寫
context.Orders.Include("Details").Include("Details.Item")
我還要加載瀏覽更詳細信息的對象,因此我試過
context.Orders.Include("Details").Include("Details.Item.Detail")
它沒有工作。如何加載完整的Order對象?