public async ValueTask <bool> MoveNextAsync()
                {
                    try
                    {
                        _concurrencyDetector?.EnterCriticalSection();

                        try
                        {
                            if (_enumerator == null)
                            {
                                var sqlQuery = _queryingEnumerable.GenerateQuery();

                                EntityFrameworkEventSource.Log.QueryExecuting();

                                _enumerator = _cosmosQueryContext.CosmosClient
                                              .ExecuteSqlQueryAsync(
                                    _selectExpression.Container,
                                    _partitionKey,
                                    sqlQuery)
                                              .GetAsyncEnumerator(_cancellationToken);
                                _cosmosQueryContext.InitializeStateManager(_standAloneStateManager);
                            }

                            var hasNext = await _enumerator.MoveNextAsync().ConfigureAwait(false);

                            Current
                                = hasNext
                                    ? _shaper(_cosmosQueryContext, _enumerator.Current)
                                    : default;

                            return(hasNext);
                        }
                        finally
                        {
                            _concurrencyDetector?.ExitCriticalSection();
                        }
                    }
                    catch (Exception exception)
                    {
                        _queryLogger.QueryIterationFailed(_contextType, exception);

                        throw;
                    }
                }
                public bool MoveNext()
                {
                    try
                    {
                        using (_cosmosQueryContext.ConcurrencyDetector.EnterCriticalSection())
                        {
                            if (_enumerator == null)
                            {
                                var sqlQuery = _queryingEnumerable.GenerateQuery();

                                EntityFrameworkEventSource.Log.QueryExecuting();

                                _enumerator = _cosmosQueryContext.CosmosClient
                                              .ExecuteSqlQuery(
                                    _selectExpression.Container,
                                    _partitionKey,
                                    sqlQuery)
                                              .GetEnumerator();
                                _cosmosQueryContext.InitializeStateManager(_standAloneStateManager);
                            }

                            var hasNext = _enumerator.MoveNext();

                            Current
                                = hasNext
                                    ? _shaper(_cosmosQueryContext, _enumerator.Current)
                                    : default;

                            return(hasNext);
                        }
                    }
                    catch (Exception exception)
                    {
                        _queryLogger.QueryIterationFailed(_contextType, exception);

                        throw;
                    }
                }
                public async ValueTask <bool> MoveNextAsync()
                {
                    try
                    {
                        using (_cosmosQueryContext.ConcurrencyDetector.EnterCriticalSection())
                        {
                            if (_enumerator == null)
                            {
                                var sqlQuery = _queryingEnumerable.GenerateQuery();

                                _enumerator = _cosmosQueryContext.CosmosClient
                                              .ExecuteSqlQueryAsync(
                                    _selectExpression.Container,
                                    _partitionKey,
                                    sqlQuery)
                                              .GetAsyncEnumerator(_cancellationToken);
                                _cosmosQueryContext.InitializeStateManager(_performIdentityResolution);
                            }

                            var hasNext = await _enumerator.MoveNextAsync();

                            Current
                                = hasNext
                                    ? _shaper(_cosmosQueryContext, _enumerator.Current)
                                    : default;

                            return(hasNext);
                        }
                    }
                    catch (Exception exception)
                    {
                        _queryLogger.QueryIterationFailed(_contextType, exception);

                        throw;
                    }
                }