Skip to content

Commit

Permalink
updated naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Willey committed Jul 17, 2019
1 parent f7e01b0 commit 53537a8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Microsoft.Azure.Cosmos/src/Linq/CosmosLinqQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace Microsoft.Azure.Cosmos.Linq
/// <seealso cref="CosmosLinqQueryProvider"/>
internal sealed class CosmosLinqQuery<T> : IDocumentQuery<T>, IOrderedQueryable<T>
{
private readonly Expression expression;
private readonly CosmosLinqQueryProvider queryProvider;
private readonly Guid correlatedActivityId;

Expand All @@ -44,8 +43,10 @@ public CosmosLinqQuery(
this.queryClient = queryClient ?? throw new ArgumentNullException(nameof(queryClient));
this.continuationToken = continuationToken;
this.cosmosQueryRequestOptions = cosmosQueryRequestOptions;
this.expression = expression ?? Expression.Constant(this);
this.Expression = expression ?? Expression.Constant(this);
this.allowSynchronousQueryExecution = allowSynchronousQueryExecution;
this.correlatedActivityId = Guid.NewGuid();

this.queryProvider = new CosmosLinqQueryProvider(
container,
responseFactory,
Expand All @@ -54,7 +55,6 @@ public CosmosLinqQuery(
cosmosQueryRequestOptions,
this.allowSynchronousQueryExecution,
this.queryClient.OnExecuteScalarQueryCallback);
this.correlatedActivityId = Guid.NewGuid();
}

public CosmosLinqQuery(
Expand All @@ -77,7 +77,7 @@ public CosmosLinqQuery(

public Type ElementType => typeof(T);

public Expression Expression => this.expression;
public Expression Expression { get; }

public IQueryProvider Provider => this.queryProvider;

Expand All @@ -98,11 +98,11 @@ public IEnumerator<T> GetEnumerator()
" use GetItemsQueryIterator to execute asynchronously");
}

FeedIterator<T> localQueryExecutionContext = this.CreateFeedIterator(false);
while (localQueryExecutionContext.HasMoreResults)
FeedIterator<T> localFeedIterator = this.CreateFeedIterator(false);
while (localFeedIterator.HasMoreResults)
{
#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits
FeedResponse<T> items = TaskHelper.InlineIfPossible(() => localQueryExecutionContext.ReadNextAsync(CancellationToken.None), null).GetAwaiter().GetResult();
FeedResponse<T> items = TaskHelper.InlineIfPossible(() => localFeedIterator.ReadNextAsync(CancellationToken.None), null).GetAwaiter().GetResult();
#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits

foreach (T item in items)
Expand All @@ -123,7 +123,7 @@ IEnumerator IEnumerable.GetEnumerator()

public override string ToString()
{
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.expression);
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.Expression);
if (querySpec != null)
{
return JsonConvert.SerializeObject(querySpec);
Expand All @@ -134,13 +134,13 @@ public override string ToString()

public string ToSqlQueryText()
{
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.expression);
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.Expression);
return querySpec?.QueryText;
}

public FeedIterator<T> ToFeedIterator()
{
return CreateFeedIterator(true);
return this.CreateFeedIterator(true);
}

public void Dispose()
Expand All @@ -160,7 +160,7 @@ Task<DocumentFeedResponse<dynamic>> IDocumentQuery<T>.ExecuteNextAsync(Cancellat

private FeedIterator<T> CreateFeedIterator(bool isContinuationExcpected)
{
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.expression);
SqlQuerySpec querySpec = DocumentQueryEvaluator.Evaluate(this.Expression);

FeedIterator streamIterator = this.container.GetItemQueryStreamIteratorInternal(
sqlQuerySpec: querySpec,
Expand Down

0 comments on commit 53537a8

Please sign in to comment.