Loading thousands of entities with LINQ

4 posts, 1 answers
  1. Thomas
    Thomas avatar
    9 posts
    Member since:
    Sep 2008

    Posted 20 Jan 2010 Link to this post

    I am trying to load a list with thousands of entities with LINQ:

    var customers = scope.Extent<Customer>(); // about 80000 entries 

    The problem is that each Customer object references to other tables like CustomerState and Country. Now I try to bind this list to a Grid (no Telerik Grid) which contains these joined properties.

    OpenAccess seems to load each entry with it's joins. So the app comes to a complete halt.

    What can I do? Could views solve the problem? Where is this documented?
  2. Answer
    Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 20 Jan 2010 Link to this post

    Hello Thomas,
    Please have a look at our FetchPlans. You can specifiy what you want to load together and OpenAccess does in with minimal calls.

    All the best,
    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.
  3. DevCraft banner
  4. Thomas
    Thomas avatar
    9 posts
    Member since:
    Sep 2008

    Posted 21 Jan 2010 Link to this post

    Fetchplans improved performance very much. Yet it still takes some time to display my entries.
    Is there anything else that can be done?
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 22 Jan 2010 Link to this post

    Hello Thomas,
    You should analyze how many queries are really executed to display your data. You can do that by using a tool from the database vendor or our logging mechanism. A good way is to implement your own trace listener and count the amount of query execute calls, if you display the actual value somewhere in you app you can always see if there are too many calls. You can find the example here in the product:

    examples\ExamplesWin\Examples\FetchPlans\OpenAccessTracer.cs/vb

    Greetings,
    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