using System.Linq.Expressions; using Connected.Expressions.Expressions; using Connected.Expressions.Visitors; namespace Connected.Expressions.Translation.Resolvers; internal sealed class AggregateResolver : DatabaseVisitor { private AggregateResolver() { Aggregates = new(); } private List Aggregates { get; } internal static List Resolve(Expression expression) { var resolver = new AggregateResolver(); resolver.Visit(expression); return resolver.Aggregates; } protected override Expression VisitAggregateSubquery(AggregateSubqueryExpression aggregate) { Aggregates.Add(aggregate); return base.VisitAggregateSubquery(aggregate); } }