Ejemplo n.º 1
0
        public async ValueTask <bool> MoveNextAsync()
        {
            var has = await _enumerator.MoveNextAsync();

            SetOrderValues();
            return(has);
        }
        public async Task <bool> MoveNext(CancellationToken cancellationToken)
#endif
        {
            //如果合并数据的时候不需要跳过也没有take多少那么就是直接next
            while (_skip.GetValueOrDefault() > this.realSkip)
            {
#if !EFCORE2
                var has = await _enumerator.MoveNextAsync();
#endif
#if EFCORE2
                var has = await _enumerator.MoveNext(cancellationToken);
#endif
                realSkip++;
                if (!has)
                {
                    return(false);
                }
            }

#if !EFCORE2
            var next = await _enumerator.MoveNextAsync();
#endif
#if EFCORE2
            var next = await _enumerator.MoveNext(cancellationToken);
#endif
            if (next)
            {
                if (_take.HasValue)
                {
                    realTake++;
                    if (realTake >= _take.Value)
                    {
                        return(false);
                    }
                }
            }

            return(next);
        }