Наследование: Signum.Engine.Linq.DbExpressionVisitor
Пример #1
0
        internal static Expression Optimize(Expression binded, QueryBinder binder, AliasGenerator aliasGenerator, HeavyProfiler.Tracer log)
        {
            log.Switch("Aggregate");
            Expression rewrited = AggregateRewriter.Rewrite(binded);

            log.Switch("EntityCompleter");
            Expression completed = EntityCompleter.Complete(rewrited, binder);

            log.Switch("AliasReplacer");
            Expression replaced = AliasProjectionReplacer.Replace(completed, aliasGenerator);

            log.Switch("OrderBy");
            Expression orderRewrited = OrderByRewriter.Rewrite(replaced);

            log.Switch("Rebinder");
            Expression rebinded = QueryRebinder.Rebind(orderRewrited);

            log.Switch("UnusedColumn");
            Expression columnCleaned = UnusedColumnRemover.Remove(rebinded);

            log.Switch("Redundant");
            Expression subqueryCleaned = RedundantSubqueryRemover.Remove(columnCleaned);

            log.Switch("Condition");
            Expression rewriteConditions = ConditionsRewriter.Rewrite(subqueryCleaned);

            log.Switch("Scalar");
            Expression scalar = ScalarSubqueryRewriter.Rewrite(rewriteConditions);

            return(scalar);
        }
Пример #2
0
        public static Expression Remove(Expression expression)
        {
            var removed    = new RedundantSubqueryRemover().Visit(expression);
            var merged     = SubqueryMerger.Merge(removed);
            var simplified = JoinSimplifier.Simplify(merged);

            return(simplified);
        }
Пример #3
0
        static internal ProjectionExpression Flatten(ProjectionExpression proj, AliasGenerator aliasGenerator)
        {
            var result = (ProjectionExpression) new ChildProjectionFlattener(aliasGenerator).Visit(proj);

            if (result == proj)
            {
                return(result);
            }

            Expression columnCleaned   = UnusedColumnRemover.Remove(result);
            Expression subqueryCleaned = RedundantSubqueryRemover.Remove(columnCleaned);

            return((ProjectionExpression)subqueryCleaned);
        }
 public static Expression Remove(Expression expression)
 {
     expression = new RedundantSubqueryRemover().Visit(expression);
     expression = SubqueryMerger.Merge(expression);
     return(expression);
 }
Пример #5
0
 public static Expression Remove(Expression expression)
 {
     expression = new RedundantSubqueryRemover().Visit(expression);
     expression = SubqueryMerger.Merge(expression);
     return expression;
 }