This is a migrated thread and some comments may be shown as answers.

I hope I'm wrong

1 Answer 58 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Espen Harlinn
Top achievements
Rank 1
Espen Harlinn asked on 23 Jan 2010, 01:33 PM
1. After a really quick scan of the OpenAccess source code it seems to me that the OA Linq implementation evaluates expressions on it's own as in: While the query could have been translated to SQL, everything required to evaluate the linq expression gets loaded from the database during OA linq expression evaluation.

2. If you want to avoid loading the entire table you have to start out with something that initially is less than the entire table, for instance a mapped one to many relation allows you to access the "many" side of the relation as a collection exposed as a property of the object representing the "one" side of the relation.

3. As for lazy loading: When I access the many side collection of a reverse mapped on-to-many relation - the entire set of related elements are loaded by OA once OA starts loading the elements. If I only want to access the first detail element - as in one element - on the many side of the relation, and there are 300.000 elements on the many side, all of them gets loaded.

If this is correct one can easily end up with a preformance overhead of several thousand percent compared to using System.Data.SqlClient directly.

Am I right?

Regards
Espen Harlinn

1 Answer, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 25 Jan 2010, 09:14 AM
Hi Espen Harlinn,
Yes, we have to evaluate the linq statement by our own. This is necessary because the mapping that you can do is OpenAccess specific and has to be used to generate the SQL. That does not mean that it is slow.

We have a strict separation between writing the query and specifying the resulting object graph. You might want to reuse the same query but you need different members from the result set. To achieve this separation we have our FetchPlans. You specify, per a use case, which data you need and OpenAccess uses this information for the query calculation but also in case of lazy loading. This makes you code very flexible, you can define such fetchplans without touching your query or use case implementation.

Please have a look here as well:

http://www.telerik.com/help/openaccess-orm/openaccess-application-scenarios-using-fetch-plans.html

Kind regards,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
LINQ (LINQ specific questions)
Asked by
Espen Harlinn
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Share this question
or