Lazy loading?

Dec 2, 2010 at 9:12 PM

Let's say I do something like this:

var peeps = context.People.ToList();

foreach (var peep in peeps)

{

ListAddresses(peep.Addresses);

}

Based on my tests so far, peep.Addresses is always null. This seems to occur whether or not I .ToList() the context.People.

Just curious if I'm doing something wrong. Trying to figure out this thing's capabilities.

Coordinator
Dec 2, 2010 at 9:22 PM

No lazy loading.  You need to tell the context what you would like to include (like EF v1).  If you download the source code you can find an example in the LinqToVfp.Northwind.Tests project – ExecutionTests.cs – TestCustomersIncludeOrders.