This project is read-only.
1
Vote

Issue with SQLiteDataStore and fetchCount?

description

Hi,

I updated to check in #105316 a while ago to add support for some SQLite requirements (running on various platforms including Windows 8.1)

All appeared to work well but an issue has been raised with me that the fetchCount on DataStore<T>.Select() is being disregarded.

I'm not entirely sure why this is but having looked into I see it seems to be related to use of yield

SQLiteDataStore.cs
IEnumerable<object> Select(string entityName, Type objectType, IEnumerable<FilterCondition> filters, int fetchCount, int firstRowOffset, bool fillReferences)
{

                            // changed from
                            //items.Add(item);
                            yield return item;

                            if ((fetchCount > 0) && (items.Count >= fetchCount))
                            {
                                break;
                            }

}
If I change the code above to use items.add() instead of the yield then the behaviour is correct.

I am wondering if somehow the sparse population of the list from the yield means the items.Count test isn't operating correctly?

Cheers, Alex

comments