Entities: deferred loading?

Entities: deferred loading?

Postby mpovidlov » Sat 31 Jan 2009 01:12

I am using ADO.NET Entity model with Oracle.
When I query a table, its child entities are left unloaded. I could not find how I could enforce loading. Documentation on Entities mention DeferredLoadingEnabled property but I could not find it in the generated Entity class.
Probably it is something easy. Note: I process huge amounts of data and do not want to load all the data, I need a few records but loaded completely.
Thanks
mpovidlov
 
Posts: 20
Joined: Tue 06 Jan 2009 00:34
Location: US

Postby AndreyR » Mon 02 Feb 2009 09:53

The DeferredLoadingEnabled property is a property of DataContext class (LINQ to SQL), not of the ObjectContext class (LINQ to Entities).
I recommend you 2 alternatives:
1. Explicitly call the Load() method for all records you need child objects be loaded for, like in the following code example:
Code: Select all
        DEPT d = (from dept in db.DEPT
                 where dept.DEPTNO == 10
                 select dept).First();
        d.EMP.Load();

2. Use the Include() method:
Code: Select all
        DEPT d = (from dept in db.DEPT.Include("EMP")
                 where dept.DEPTNO == 10
                 select dept).First();
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for Oracle