Eager Load

Eager Load

Postby F8R » Tue 22 Feb 2011 08:02

Hi, I'm evaluating LINQ Connect for my next project.
I'm new to LINQ also, I have this query :

Code: Select all
       var categories = from c in ctx.Categories.LoadWith(n => n.Products)
                                 orderby c.CategoryName ascending
                                 select c;


This query was eager load, but I want to output :

Code: Select all
select new { c.Name, c.Products }


But from tracing sql statement, when I accessing Product from second query, Product was retrive using lazy-load.

Thanks
F8R
 
Posts: 2
Joined: Tue 22 Feb 2011 07:52

Postby StanislavK » Tue 22 Feb 2011 16:40

Thank you for your report, we have reproduced the issue. We will analyze it and inform you about the results as soon as possible.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby F8R » Mon 28 Feb 2011 21:55

Let me know when this problem fixed, because I needed this feature in my project.
F8R
 
Posts: 2
Joined: Tue 22 Feb 2011 07:52

Postby StanislavK » Wed 02 Mar 2011 12:44

We are working on this issue, and will post here as soon as it is fixed.

As a temporary workaround, you can select the whole entity object in the query, enumerate the sequence, and then select an anonymous type, e.g.,
Code: Select all
var categories = from c2 in
                   (from c in ctx.Categories.LoadWith(n => n.Products)
                    orderby c.CategoryName ascending
                    select c)
                    .ToList()
                 select new { c2.Name, c2.Products };
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby StanislavK » Thu 19 May 2011 11:25

We have fixed the issue with eager loading for queries that include anonymous types. The fix is available in the latest 2.50.23 version of LinqConnect. The new build can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial version) or from Registered Users' Area (provided that you have an active subscription):
http://secure.devart.com/

For the detailed information about the improvements and fixes available in LinqConnect 2.50.23, please refer to
http://www.devart.com/forums/viewtopic.php?t=21036
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to LinqConnect (LINQ to SQL support)