Exemplo n.º 1
0
                public async Task <bool> MoveNextAsync()
                {
                    if (complete)
                    {
                        // to parallel IEnumerable<T>, subsequent calls to MoveNextAsync after it has returned false should
                        // also return false, rather than throwing
                        return(false);
                    }

                    if (wasInitialized == false)
                    {
                        await InitAsync().ConfigureAwait(false);

                        wasInitialized = true;
                    }

                    if (await reader.ReadAsync().ConfigureAwait(false) == false)
                    {
                        throw new InvalidOperationException("Unexpected end of data. This exception should not happen and is probably a bug.");
                    }

                    if (reader.TokenType == JsonToken.EndArray)
                    {
                        complete = true;

                        await EnsureValidEndOfResponse().ConfigureAwait(false);

                        Dispose();
                        return(false);
                    }

                    Current = (RavenJObject)await RavenJToken.ReadFromAsync(reader).ConfigureAwait(false);

                    return(true);
                }