Ejemplo n.º 1
0
                private SelectValueGroupByValues(GroupByValue groupByValue)
                {
                    if (groupByValue == null)
                    {
                        throw new ArgumentNullException(nameof(groupByValue));
                    }

                    this.groupByValue = groupByValue;
                }
Ejemplo n.º 2
0
                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));
                }
Ejemplo n.º 3
0
                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));
                }
Ejemplo n.º 4
0
                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]);
                    }
                }
Ejemplo n.º 5
0
                public static SelectValueGroupByValues Create()
                {
                    GroupByValue groupByValue = GroupByValue.Create(aggregateOperator: null);

                    return(new SelectValueGroupByValues(groupByValue));
                }