title: How to deal with large result sets with Linq to Entities?
body: <p>I have a fairly complex linq to entities query that I display on a website. It uses paging so I never pull down more than 50 records at a time for display.</p>
  
  <p>But I also want to give the user the option to export the full results to Excel or some other file format.</p>
  
  <p>My concern is that there could potentially be a large # of records all being loaded into memory at one time to do this. </p>
  
  <p>Is there a way to process a linq result set 1 record at a time like you could w/ a datareader so only 1 record is really being kept in memory at a time?</p>
  
  <p>I've seen suggestions that if you enumerate over the linq query w/ a foreach loop that the records will not all be read into memory at once and would not overwelm the server.</p>
  
  <p>Does anyone have a link to something I could read to verify this?</p>
  
  <p>I'd appreciate any help.</p>
  
  <p>Thanks</p>