public static AggregateAggregateValue Create(AggregateOperator aggregateOperator) { IAggregator aggregator; switch (aggregateOperator) { case AggregateOperator.Average: aggregator = new AverageAggregator(); break; case AggregateOperator.Count: aggregator = new CountAggregator(); break; case AggregateOperator.Max: aggregator = new MinMaxAggregator(isMinAggregation: false); break; case AggregateOperator.Min: aggregator = new MinMaxAggregator(isMinAggregation: true); break; case AggregateOperator.Sum: aggregator = new SumAggregator(); break; default: throw new ArgumentException($"Unknown {nameof(AggregateOperator)}: {aggregateOperator}."); } return(new AggregateAggregateValue(aggregator)); }
public static TryCatch <AggregateValue> TryCreate( AggregateOperator aggregateOperator, CosmosElement continuationToken) { TryCatch <IAggregator> tryCreateAggregator; switch (aggregateOperator) { case AggregateOperator.Average: tryCreateAggregator = AverageAggregator.TryCreate(continuationToken); break; case AggregateOperator.Count: tryCreateAggregator = CountAggregator.TryCreate(continuationToken); break; case AggregateOperator.Max: tryCreateAggregator = MinMaxAggregator.TryCreateMaxAggregator(continuationToken); break; case AggregateOperator.Min: tryCreateAggregator = MinMaxAggregator.TryCreateMinAggregator(continuationToken); break; case AggregateOperator.Sum: tryCreateAggregator = SumAggregator.TryCreate(continuationToken); break; default: throw new ArgumentException($"Unknown {nameof(AggregateOperator)}: {aggregateOperator}."); } return(tryCreateAggregator.Try <AggregateValue>((aggregator) => new AggregateAggregateValue(aggregator))); }
public static AggregateAggregateValue Create( AggregateOperator aggregateOperator, string continuationToken) { IAggregator aggregator; switch (aggregateOperator) { case AggregateOperator.Average: aggregator = AverageAggregator.Create(continuationToken); break; case AggregateOperator.Count: aggregator = CountAggregator.Create(continuationToken); break; case AggregateOperator.Max: aggregator = MinMaxAggregator.CreateMaxAggregator(continuationToken); break; case AggregateOperator.Min: aggregator = MinMaxAggregator.CreateMinAggregator(continuationToken); break; case AggregateOperator.Sum: aggregator = SumAggregator.Create(continuationToken); break; default: throw new ArgumentException($"Unknown {nameof(AggregateOperator)}: {aggregateOperator}."); } return(new AggregateAggregateValue(aggregator)); }