views:

28

answers:

0

I'm using Linq to Entities for some simple database access.

In the automatically generated entities, there's a Class IndexMeta, which refers to a collection of objects of class IndexData.

Although i set the ObjectContext like this: this.xxxDataEntities.ContextOptions.LazyLoadingEnabled = true;

It seems the DataEntities is still doing eager loading. After i select all the IndexMeta in the table as an IEnumerable, once i start to iterate through the IEnumerable, all IndexMeta objects' collection of IndexData has already been loaded.

Why is the LazyLoadingEnabled option not working?