public static SelectListAggregateValues Create(IReadOnlyDictionary <string, AggregateOperator?> aggregateAliasToAggregateType) { Dictionary <string, AggregateValue> groupingTable = new Dictionary <string, AggregateValue>(); foreach (KeyValuePair <string, AggregateOperator?> aliasToAggregate in aggregateAliasToAggregateType) { string alias = aliasToAggregate.Key; AggregateOperator?aggregateOperator = aliasToAggregate.Value; groupingTable[alias] = AggregateValue.Create(aggregateOperator); } return(new SelectListAggregateValues(groupingTable)); }
public static SelectListAggregateValues Create( CosmosQueryClient cosmosQueryClient, IReadOnlyDictionary <string, AggregateOperator?> aggregateAliasToAggregateType, IReadOnlyList <string> orderedAliases, string continuationToken) { CosmosObject aliasToContinuationToken; if (continuationToken != null) { if (!CosmosElement.TryParse(continuationToken, out aliasToContinuationToken)) { throw cosmosQueryClient.CreateBadRequestException( $"{nameof(SelectListAggregateValues)} continuation token is malformed: {continuationToken}."); } } else { aliasToContinuationToken = null; } Dictionary <string, AggregateValue> groupingTable = new Dictionary <string, AggregateValue>(); foreach (KeyValuePair <string, AggregateOperator?> aliasToAggregate in aggregateAliasToAggregateType) { string alias = aliasToAggregate.Key; AggregateOperator?aggregateOperator = aliasToAggregate.Value; string aliasContinuationToken; if (aliasToContinuationToken != null) { if (!(aliasToContinuationToken[alias] is CosmosString parsedAliasContinuationToken)) { throw cosmosQueryClient.CreateBadRequestException( $"{nameof(SelectListAggregateValues)} continuation token is malformed: {continuationToken}."); } aliasContinuationToken = parsedAliasContinuationToken.Value; } else { aliasContinuationToken = null; } groupingTable[alias] = AggregateValue.Create(aggregateOperator, aliasContinuationToken); } return(new SelectListAggregateValues(groupingTable, orderedAliases)); }
public static SelectValueAggregateValues Create(AggregateOperator?aggregateOperator) { AggregateValue aggregateValue = AggregateValue.Create(aggregateOperator); return(new SelectValueAggregateValues(aggregateValue)); }
public static SelectValueAggregateValues Create(AggregateOperator?aggregateOperator, string continuationToken) { AggregateValue aggregateValue = AggregateValue.Create(aggregateOperator, continuationToken); return(new SelectValueAggregateValues(aggregateValue)); }