I've got what is probably a silly problem. I want to include the child of a child in my query. The problem appears to be the fact that my grandchild is m:1 and the only syntax I see examples for (and work) are for 1:m. I have the following type of data.
Order - Standard type of order example.
Order Detail - 1:m with Order, the line items of an order.
Product - Referenced by Order Detail as m:1 (Order Detail : Product).
I've got a query something like the following.
var query =
manager.Order
.Include(Order.PathFor(order => order.OrderDetails);
This works fine and fetches from the db once as expected. However, I'm trying to display product for the Order Detail in a grid and since it's not included (or in cache at the time), it does a lazy call for every record to retrieve the Product record.
In the examples of using 1:m includes, it looks like you can do this:
var query =
manager.Order
.Include(Order.PathFor(order => order.OrderDetails)
.Include(Order.PathFor(order => order.OrderDetails.Products);
But since that relationship is m:1, you don't get an option for the Products relation. Is there some other way other than just flat querying the Product table to load it in cache (in my real example, it's actually several related tables).
Thanks,
Scott