protected DistinctDocumentQueryExecutionComponent( DistinctMap distinctMap, IDocumentQueryExecutionComponent source) : base(source) { this.distinctMap = distinctMap ?? throw new ArgumentNullException(nameof(distinctMap)); }
private ComputeDistinctDocumentQueryExecutionComponent( DistinctQueryType distinctQueryType, DistinctMap distinctMap, IDocumentQueryExecutionComponent source) : base(distinctMap, source) { }
private ClientDistinctDocumentQueryExecutionComponent( DistinctQueryType distinctQueryType, DistinctMap distinctMap, IDocumentQueryExecutionComponent source) : base(distinctMap, source) { if ((distinctQueryType != DistinctQueryType.Unordered) && (distinctQueryType != DistinctQueryType.Ordered)) { throw new ArgumentException($"Unknown {nameof(DistinctQueryType)}: {distinctQueryType}."); } this.distinctQueryType = distinctQueryType; }
public static async Task <TryCatch <IDocumentQueryExecutionComponent> > TryCreateAsync( CosmosElement requestContinuation, Func <CosmosElement, Task <TryCatch <IDocumentQueryExecutionComponent> > > tryCreateSourceAsync, DistinctQueryType distinctQueryType) { if (tryCreateSourceAsync == null) { throw new ArgumentNullException(nameof(tryCreateSourceAsync)); } DistinctContinuationToken distinctContinuationToken; if (requestContinuation != null) { if (!DistinctContinuationToken.TryParse(requestContinuation, out distinctContinuationToken)) { return(TryCatch <IDocumentQueryExecutionComponent> .FromException( new MalformedContinuationTokenException($"Invalid {nameof(DistinctContinuationToken)}: {requestContinuation}"))); } } else { distinctContinuationToken = new DistinctContinuationToken(sourceToken: null, distinctMapToken: null); } TryCatch <DistinctMap> tryCreateDistinctMap = DistinctMap.TryCreate( distinctQueryType, distinctContinuationToken.DistinctMapToken); if (!tryCreateDistinctMap.Succeeded) { return(TryCatch <IDocumentQueryExecutionComponent> .FromException(tryCreateDistinctMap.Exception)); } TryCatch <IDocumentQueryExecutionComponent> tryCreateSource = await tryCreateSourceAsync( distinctContinuationToken.SourceToken); if (!tryCreateSource.Succeeded) { return(TryCatch <IDocumentQueryExecutionComponent> .FromException(tryCreateSource.Exception)); } return(TryCatch <IDocumentQueryExecutionComponent> .FromResult( new ComputeDistinctDocumentQueryExecutionComponent( distinctQueryType, tryCreateDistinctMap.Result, tryCreateSource.Result))); }