コード例 #1
0
        protected override Expression VisitSelect(SqlSelectExpression select)
        {
            select = (SqlSelectExpression)base.VisitSelect(select);

            // Expand all purely redundant subqueries

            var redundantQueries = RedundantSubqueryFinder.Find(select.From);

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

            return(select);
        }
コード例 #2
0
        protected override Expression VisitProjection(SqlProjectionExpression projection)
        {
            projection = (SqlProjectionExpression)base.VisitProjection(projection);

            if (projection.Select.From is SqlSelectExpression)
            {
                var redundantQueries = RedundantSubqueryFinder.Find(projection.Select);

                if (redundantQueries != null)
                {
                    projection = SubqueryRemover.Remove(projection, redundantQueries);
                }
            }

            return(projection);
        }