private SelectValueGroupByValues(GroupByValue groupByValue) { if (groupByValue == null) { throw new ArgumentNullException(nameof(groupByValue)); } this.groupByValue = groupByValue; }
public static SelectListGroupByValues Create(IReadOnlyDictionary <string, AggregateOperator?> groupByAliasToAggregateType) { Dictionary <string, GroupByValue> groupingTable = new Dictionary <string, GroupByValue>(); foreach (KeyValuePair <string, AggregateOperator?> aliasToAggregate in groupByAliasToAggregateType) { string alias = aliasToAggregate.Key; AggregateOperator?aggregateOperator = aliasToAggregate.Value; groupingTable[alias] = GroupByValue.Create(aggregateOperator); } return(new SelectListGroupByValues(groupingTable)); }
public override CosmosElement GetResult() { Dictionary <string, CosmosElement> mergedResult = new Dictionary <string, CosmosElement>(); foreach (KeyValuePair <string, GroupByValue> aliasAndValue in this.aliasToValue) { string alias = aliasAndValue.Key; GroupByValue groupByValue = aliasAndValue.Value; mergedResult[alias] = groupByValue.Result; } return(CosmosObject.Create(mergedResult)); }
public override void AddValues(CosmosElement values) { if (!(values is CosmosObject payload)) { throw new ArgumentException("values is not an object."); } foreach (KeyValuePair <string, GroupByValue> aliasAndValue in this.aliasToValue) { string alias = aliasAndValue.Key; GroupByValue groupByValue = aliasAndValue.Value; groupByValue.AddValue(payload[alias]); } }
public static SelectValueGroupByValues Create() { GroupByValue groupByValue = GroupByValue.Create(aggregateOperator: null); return(new SelectValueGroupByValues(groupByValue)); }