Marcus wrote:
Otis wrote:
Ian wrote:
It think it would also be useful to be able to stream an EntityCollection into memory like a DataReader does.
I could use this for sending out emails to everyone on an email list.
instead of fetching them all first, you mean? I toyed with the idea of having an EntityReader object, however except browsing through large sets of objects without using paging, I couldn't find another situation in which this would be useful, simply because IMHO it's always better to disconnect a.s.a.p. from a db and not leave open connections.
So in your situation I'd use paging.
Isn't paging unsafe here? If you get page 1 and start sending emails and meanwhile a customer on page 1 is deleted, page 2 will now contain the wrong data as the first expected row is actually now on page 1 (because of the delete)...
hmm, you're right. Though, streaming isn't safe either: if you pull the data in query 1, and another query removes a row at position 1, you will still see that row, because the datareader caches results on the server.
However, you won't miss data, as you would with paging, totally agreed. I didn't think of that.