How about something very explicit then? Also I think the default page
size here should be 128.
public static IEnumerable<T> GetAllResultsWithPaging<T>(this
IRavenQueryable<T> queryable,
int pageSize = 128, bool
expandSessionRequestLimitAsNeededWhichMightBeDangerous = false)
{
...
if (expandSessionRequestLimitAsNeededWhichMightBeDangerous)
// increase the limit as we go like I currently have implemented
else if ((totalResults / pageSize) + currentRequests > maxRequests)
throw new InvalidOperationException("Can't get all pages because
you'll exceed the request limit.");
...
}
Not sure how I feel about your opinion on yield. It is a language
framework feature, after all. Is it just that you feel people are in
a bad habit of using .ToList() when it's unnecessary? Perhaps with
the change, it's now more "safe by default", and if you are smart
enough to enumerate properly then you get that added bonus of
streaming pages as you consume them.
On Dec 12, 12:09 pm, "Oren Eini (Ayende Rahien)" <
aye...@ayende.com>