I hope I'm wrong

Thread is closed for posting
2 posts, 0 answers
  1. Espen Harlinn
    Espen Harlinn avatar
    26 posts
    Member since:
    Jul 2009

    Posted 23 Jan 2010 Link to this post

    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?

    Espen Harlinn

  2. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 25 Jan 2010 Link to this post

    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:


    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.
Back to Top