protected override Expression VisitSelect(SqlSelectExpression select) { select = (SqlSelectExpression)base.VisitSelect(select); // Expand all purely redundant subqueries var redundantQueries = SqlRedundantSubqueryFinder.Find(select.From); if (redundantQueries != null) { select = SubqueryRemover.Remove(select, redundantQueries); } return(select); }
protected override Expression VisitProjection(SqlProjectionExpression projection) { projection = (SqlProjectionExpression)base.VisitProjection(projection); if (projection.Select.From is SqlSelectExpression) { var redundantQueries = SqlRedundantSubqueryFinder.Find(projection.Select); if (redundantQueries != null) { projection = SubqueryRemover.Remove(projection, redundantQueries); } } return(projection); }