I am using EF6 and I am trying to get a list of entities. For each entity in the list i want it to fill in the child entities in the one call.
For instance:
Order.Id
Order.ColletionOfItems
Item.Id
Item.OrderId
Item.ProductName
Item.CollectionOfOptions
Option.Name
Option.Value
using(var db = DbContext)
{ //I want to fill in everything during this call as I am using all of it in the
//The calling function.
OrderList = db.Orders.Select().include //This is where I am stuck
return OrderList;
}
I want the returned collection to have all the orders, all the items associated to the individual order and all the options associated to an individual item.
How do I build my linq statement to do this? Is there a better way then the .Include("MyMajicString")
? What should I actual search for because my searches have led to very few acceptable responses?