protected override SqlExpression VisitAggregate(AggregateExpression aggregate)
 {
     this.hasAggregate = true;
     return aggregate;
 }
 protected override SqlExpression VisitAggregate(AggregateExpression expr)
 {
     this.Write(expr.AggregateName + "(");
     this.Write(expr.IsDistinct ? "DISTINCT " : "");
     if (expr.Argument != null)
     {
         this.Visit(expr.Argument);
     }
     else if(RequiresAsteriskWhenNoArgument(expr.AggregateName))
     {
         this.Write("*");
     }
     this.Write(") ");
     return expr;
 }