コード例 #1
0
        internal static List <SelectExpression> Gather(Expression source)
        {
            RedundantSubqueryGatherer gatherer = new RedundantSubqueryGatherer();

            gatherer.Visit(source);
            return(gatherer.redundant);
        }
コード例 #2
0
 protected override Expression VisitProjection(ProjectionExpression proj)
 {
     proj = (ProjectionExpression)base.VisitProjection(proj);
     if (proj.Select.From is SelectExpression)
     {
         List <SelectExpression> redundant = RedundantSubqueryGatherer.Gather(proj.Select);
         if (redundant != null)
         {
             proj = SubqueryRemover.Remove(proj, redundant);
         }
     }
     return(proj);
 }
コード例 #3
0
        protected override Expression VisitSelect(SelectExpression select)
        {
            select = (SelectExpression)base.VisitSelect(select);

            // first remove all purely redundant subqueries
            List <SelectExpression> redundant = RedundantSubqueryGatherer.Gather(select.From);

            if (redundant != null)
            {
                select = SubqueryRemover.Remove(select, redundant);
            }

            return(select);
        }