title: EF 5 large data load strategy
body: <p>Good day,</p>
  
  <p>I have the following tables </p>
  
  <p>PARENT 1=>N CHILDREN 1=>N GRANDCHILDREN. </p>
  
  <p>Both tables have over 30 columns. </p>
  
  <p>I need to select over 50,000 records form PARENT, plus I will need certain fields from CHILDREN and GRANDCHILDREN. Data is needed to manipulate in memory (complex algorithms on what's been selected). </p>
  
  <p>I am using Entity Framework 5. </p>
  
  <p>I tried various combinations of Eager loading (Include, projection etc), but I am still not able to make it perform better then it perorms with LINQ-to-SQL in the following scenario: </p>
  
  <p>"
  SELECT from  PROJECTS</p>
  
  <p>on binding of each row: 
  SELECT from CHILDREN
  SELECT from GRANDCHILDREN</p>
  
  <p>"</p>
  
  <p>it generates at least 50,001 calls to the DB, but it's still performing better then any of my EF approaches, which take over x5 longer than the current LINQ-to-SQL design. </p>
  
  <p>The best solution would be to have an WHERE IN query on children, but it's not available in EF 5 in native implementation (contains doesn't cut it - too slow for badly done...). </p>
  
  <p>Any ideas will be greatly appreciated. </p>
  
  <p>Thanks, </p>