I want to retrieve all carts from current and two days back. I retrieve the carts like this:
var cartFilter = new CartFilter()
ModifiedFrom = DateTime.UtcNow.AddDays(-2),
ModifiedTo = DateTime.UtcNow,
StartingRecord = 0,
RecordsToRetrieve = 20000
var carts = _serializableCartDB.FindCarts(cartFilter);
I could loop over this until I find the cart that I want, by changing StartingRecord for each iteration:
Loop 1: get 0-20000
Loop 2: get 20001...40000
Loop 3: get 40001...60000...found cart I want...now break.
Question is, whether there is an easier way to retrieve all carts in one go?
No, you are doing it quite correctly - even though I think 20000 is still too much. Loading in batches is a good way to ensure you are not running into performance problems like timeout exception/out of memory exception