public async Task <bool> MoveNext(CancellationToken cancellationToken) { if (_isFirstMoveNext) { _isFirstMoveNext = false; _isMoveNext = await _dbEnumerator.MoveNextAsync().ConfigureAwait(false); } if (!_isMoveNext) { return(false); } Dictionary <String, Object> entity = await CreateEntity(_dbEnumerator, _dbEnumerator.Current, _dbEnumerator.Current).ConfigureAwait(false); Object buffer = _dbEnumerator.ClearBuffer(); _isMoveNext = await _dbEnumerator.MoveNextAsync().ConfigureAwait(false); if (!_isMoveNext && _queryContext.SkipTokenNameValues != null && _queryContext.SkipTokenAccessors != null) { SetOrderByProperties(_queryContext, entity, buffer); } Current = entity; return(true); }
public async ValueTask <bool> MoveNextAsync() { if (_isFirstMoveNext) { _isFirstMoveNext = false; _isMoveNext = await _dbEnumerator.MoveNextAsync().ConfigureAwait(false); } if (!_isMoveNext) { return(false); } Dictionary <String, Object?>?entity = null; if (_dbEnumerator.Current != null) { entity = await CreateEntity(_dbEnumerator, _dbEnumerator.Current, _dbEnumerator.Current, _cancellationToken).ConfigureAwait(false); } _dbEnumerator.ClearBuffer(); _isMoveNext = await _dbEnumerator.MoveNextAsync().ConfigureAwait(false); Current = entity; return(true); }
public async Task SerializeAsync(OeEntryFactory entryFactory, Db.OeAsyncEnumerator asyncEnumerator, OeQueryContext queryContext) { var resourceSet = new ODataResourceSet() { Count = asyncEnumerator.Count }; _writer.WriteStart(resourceSet); Object buffer = null; int count = 0; var dbEnumerator = new Db.OeDbEnumerator(asyncEnumerator, entryFactory); while (await dbEnumerator.MoveNextAsync().ConfigureAwait(false)) { Object value = dbEnumerator.Current; await WriteEntry(dbEnumerator, value, _queryContext.NavigationNextLink).ConfigureAwait(false); count++; buffer = dbEnumerator.ClearBuffer(); } if (queryContext.PageSize > 0 && count > 0 && (asyncEnumerator.Count ?? Int32.MaxValue) > count) { resourceSet.NextPageLink = BuildNextPageLink(queryContext, buffer); } _writer.WriteEnd(); }
public async Task <bool> MoveNext(CancellationToken cancellationToken) { if (_isFirstMoveNext) { _isFirstMoveNext = false; _isMoveNext = await _dbEnumerator.MoveNext().ConfigureAwait(false); } if (!_isMoveNext) { return(false); } Dictionary <String, Object> entity = await CreateEntity(_dbEnumerator, _dbEnumerator.Current, _dbEnumerator.Current).ConfigureAwait(false); _dbEnumerator.ClearBuffer(); _isMoveNext = await _dbEnumerator.MoveNext().ConfigureAwait(false); Current = entity; return(true); }