public static IQueryPipelineStage Create( DocumentContainer documentContainer, CosmosQueryContext cosmosQueryContext, InputParameters inputParameters, ITrace trace) { if (cosmosQueryContext == null) { throw new ArgumentNullException(nameof(cosmosQueryContext)); } if (inputParameters == null) { throw new ArgumentNullException(nameof(inputParameters)); } if (trace == null) { throw new ArgumentNullException(nameof(trace)); } NameCacheStaleRetryQueryPipelineStage nameCacheStaleRetryQueryPipelineStage = new NameCacheStaleRetryQueryPipelineStage( cosmosQueryContext: cosmosQueryContext, queryPipelineStageFactory: () => { // Query Iterator requires that the creation of the query context is deferred until the user calls ReadNextAsync AsyncLazy <TryCatch <IQueryPipelineStage> > lazyTryCreateStage = new AsyncLazy <TryCatch <IQueryPipelineStage> >( valueFactory: (trace, innerCancellationToken) => CosmosQueryExecutionContextFactory.TryCreateCoreContextAsync( documentContainer, cosmosQueryContext, inputParameters, trace, innerCancellationToken)); LazyQueryPipelineStage lazyQueryPipelineStage = new LazyQueryPipelineStage(lazyTryCreateStage: lazyTryCreateStage, cancellationToken: default);
public static CosmosQueryExecutionContext Create( CosmosQueryContext cosmosQueryContext, InputParameters inputParameters) { if (cosmosQueryContext == null) { throw new ArgumentNullException(nameof(cosmosQueryContext)); } if (inputParameters == null) { throw new ArgumentNullException(nameof(inputParameters)); } CosmosQueryExecutionContextWithNameCacheStaleRetry cosmosQueryExecutionContextWithNameCacheStaleRetry = new CosmosQueryExecutionContextWithNameCacheStaleRetry( cosmosQueryContext: cosmosQueryContext, cosmosQueryExecutionContextFactory: () => { // Query Iterator requires that the creation of the query context is deferred until the user calls ReadNextAsync AsyncLazy <TryCatch <CosmosQueryExecutionContext> > lazyTryCreateCosmosQueryExecutionContext = new AsyncLazy <TryCatch <CosmosQueryExecutionContext> >(valueFactory: (innerCancellationToken) => { innerCancellationToken.ThrowIfCancellationRequested(); return(CosmosQueryExecutionContextFactory.TryCreateCoreContextAsync( cosmosQueryContext, inputParameters, innerCancellationToken)); }); LazyCosmosQueryExecutionContext lazyCosmosQueryExecutionContext = new LazyCosmosQueryExecutionContext(lazyTryCreateCosmosQueryExecutionContext); return(lazyCosmosQueryExecutionContext); }); CatchAllCosmosQueryExecutionContext catchAllCosmosQueryExecutionContext = new CatchAllCosmosQueryExecutionContext(cosmosQueryExecutionContextWithNameCacheStaleRetry); return(catchAllCosmosQueryExecutionContext); }