S
sqlguru
You have two entities: Products and Orders.
The Products entity has a Orders property.
Linq automatically enabled lazy-loading but in certain cases, I would
want the Products entity to automatically load the Orders property as
well so that it won't hit the database if I'm iterating over the
orders.
Is there an automatic way?
An alternative would be to get the Products and build a list of
product IDs. Then get a list of Orders for that Product IDs. Then
iterate over the products list and assign the orders from the order
list to the order property.
The Products entity has a Orders property.
Linq automatically enabled lazy-loading but in certain cases, I would
want the Products entity to automatically load the Orders property as
well so that it won't hit the database if I'm iterating over the
orders.
Is there an automatic way?
An alternative would be to get the Products and build a list of
product IDs. Then get a list of Orders for that Product IDs. Then
iterate over the products list and assign the orders from the order
list to the order property.