You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Expressions/Translation/Resolvers/AggregateResolver.cs

31 lines
724 B

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<AggregateSubqueryExpression> Aggregates { get; }
internal static List<AggregateSubqueryExpression> 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);
}
}