Walaa wrote:
I guess you have confused LazyLoading with PrefecthPaths.
LazyLoading means for each fetched Customer, his Orders will only be loaded when accessed or requested. So Orders were not loaded up front.
On the contrary, PrefetchPaths loads all Customers' Orders up front in one shot using only one extra database Query.
Walaa thanks for your answer.
I suppose I have understood the concept and the difference between them.
Let me explain better (I hope..):
I DO NOT want to load the .Orders
I just like to have a CustomerCollection loaded with ONLY the [Customer's Table] fields! I suppose this is what loading-on-demand does out of the box, right?
I try to inspect if this really works or not, (i repeat, I don't want the .Orders collection to be loaded at once!) and I 'm searching for the method (I mean: "how to test it").
I know that if I code something like:
customers.GetMulti(filter); -- this fetches xxx rows for sure
MessageBox.Show(customers[0].Orders.Count);
then, the lazy-load mechanism will start and Orders of cutomer's[0] will be loaded.
How I know, just after .GetMulti() call, that [Orders] table hasn't be queried yet?
I write:
customers.GetMulti(filter);
if (customers[0].AlreadyFetchedOrders) MessageBox.Show("Yes");
and the answer is "Yes"
Is this normal?