customer.orders is null??

May 22, 2009 at 5:53 AM
Edited May 22, 2009 at 5:54 AM

Just playing around with the following query and I noticed that cust.orders is null. Is that intentional? I was expecting some lazy loading here. And what about preloading the orders? Here is my code: 

var customers = from c in db.Customers select c; 

foreach (Customer cust in customers)
{
    Console.Write(cust.CompanyName);
    foreach (Order order in cust.Orders)
    {
        Console.WriteLine(order.OrderID);
    }
}

May 22, 2009 at 3:56 PM

oh I see. I need to set up a Policy. Great product by the way.