Are elements returned by Linq-to-Entities query streamed from the DB one at the time or are they retrieved all at once?
- by carewithl
Are elements returned by Linq-to-Entities query streamed from the database one at the time ( as they are requested ) or are they retrieved all at once:
SampleContext context = new SampleContext(); // SampleContext derives from ObjectContext
var search = context.Contacts;
foreach (var contact in search)
{
Console.WriteLine(contact.ContactID); // is each Contact retrieved from the DB
// only when foreach requests it?
}
thank you in advance