예제 #1
0
        public virtual IEnumerable <T> GetPropertiesByRangedFilter <T>(string propertyName)
        {
            var rangeLow    = 0;
            var rangeHigh   = rangeLow;
            var isLastQuery = false;
            var endOfRange  = false;

            do
            {
                var rangeFilter  = filterBuilder.CreatePropertyRangeFilter(propertyName, rangeLow, rangeHigh, isLastQuery);
                var searchResult = FindOne(rangeFilter);
                if (searchResult.ContainsProperty(rangeFilter))
                {
                    foreach (var property in searchResult.GetProperties <T>(rangeFilter))
                    {
                        yield return(property);
                    }
                    endOfRange = isLastQuery;
                }
                else
                {
                    isLastQuery = true;
                    // break immediately if range filter is not found on first run, the group is empty
                    endOfRange = IsFirstQuery(rangeLow, rangeHigh);
                }
                if (!isLastQuery)
                {
                    rangeLow  = rangeHigh + 1;
                    rangeHigh = rangeLow;
                }
            } while(!endOfRange);
        }