Exemple #1
0
        private static Expression HandleAll(HandlerContext handlerContext)
        {
            var filteringVisitor
                = new FilteringExpressionTreeVisitor(handlerContext.QueryModelVisitor);

            var predicate
                = filteringVisitor.VisitExpression(
                      ((AllResultOperator)handlerContext.ResultOperator).Predicate);

            if (!filteringVisitor.RequiresClientEval)
            {
                var innerSelectExpression = new SelectExpression();

                innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
                innerSelectExpression.Predicate = Expression.Not(predicate);

                SetProjectionCaseExpression(
                    handlerContext,
                    new CaseExpression(Expression.Not(new ExistsExpression(innerSelectExpression))));

                return(TransformClientExpression <bool>(handlerContext));
            }

            return(handlerContext.EvalOnClient);
        }
Exemple #2
0
        private static Expression HandleAll(HandlerContext handlerContext)
        {
            var filteringVisitor
                = new SqlTranslatingExpressionVisitor(
                      handlerContext.QueryModelVisitor,
                      handlerContext.SelectExpression);

            var predicate
                = filteringVisitor.Visit(
                      ((AllResultOperator)handlerContext.ResultOperator).Predicate);

            if (predicate != null)
            {
                var innerSelectExpression = new SelectExpression();

                innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
                innerSelectExpression.Predicate = Expression.Not(predicate);

                SetProjectionConditionalExpression(
                    handlerContext,
                    Expression.Condition(
                        Expression.Not(new ExistsExpression(innerSelectExpression)),
                        Expression.Constant(true),
                        Expression.Constant(false),
                        typeof(bool)));

                return(TransformClientExpression <bool>(handlerContext));
            }

            return(handlerContext.EvalOnClient);
        }
Exemple #3
0
        private static Expression HandleAll(HandlerContext handlerContext)
        {
            var filteringVisitor
                = new RelationalQueryModelVisitor.FilteringExpressionTreeVisitor(handlerContext.QueryModelVisitor);

            var predicate
                = filteringVisitor.VisitExpression(
                      ((AllResultOperator)handlerContext.ResultOperator).Predicate);

            if (!filteringVisitor.RequiresClientEval)
            {
                var innerSelectExpression = new SelectExpression();

                innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
                innerSelectExpression.Predicate = Expression.Not(predicate);

                handlerContext.SelectExpression
                .SetProjection(
                    new CaseExpression(Expression.Not(new ExistsExpression(innerSelectExpression))));

                return(new ResultTransformingExpressionTreeVisitor(
                           handlerContext.QueryModel.MainFromClause,
                           (RelationalQueryCompilationContext)handlerContext.QueryModelVisitor.QueryCompilationContext)
                       .VisitExpression(handlerContext.QueryModelVisitor.Expression));
            }

            return(handlerContext.EvalOnClient);
        }
Exemple #4
0
        private static Expression HandleAny(HandlerContext handlerContext)
        {
            var innerSelectExpression = new SelectExpression();

            innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
            innerSelectExpression.Predicate = handlerContext.SelectExpression.Predicate;

            SetProjectionCaseExpression(
                handlerContext,
                new CaseExpression(new ExistsExpression(innerSelectExpression)));

            return(TransformClientExpression <bool>(handlerContext));
        }
Exemple #5
0
        private static Expression HandleAny(HandlerContext handlerContext)
        {
            var innerSelectExpression = new SelectExpression();

            innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
            innerSelectExpression.Predicate = handlerContext.SelectExpression.Predicate;

            handlerContext.SelectExpression
            .SetProjection(new CaseExpression(new ExistsExpression(innerSelectExpression)));

            return(new ResultTransformingExpressionTreeVisitor(
                       handlerContext.QueryModel.MainFromClause,
                       (RelationalQueryCompilationContext)handlerContext.QueryModelVisitor.QueryCompilationContext)
                   .VisitExpression(handlerContext.QueryModelVisitor.Expression));
        }
Exemple #6
0
        private static Expression HandleAny(HandlerContext handlerContext)
        {
            var innerSelectExpression = new SelectExpression();

            innerSelectExpression.AddTables(handlerContext.SelectExpression.Tables);
            innerSelectExpression.Predicate = handlerContext.SelectExpression.Predicate;

            SetProjectionConditionalExpression(
                handlerContext,
                Expression.Condition(
                    new ExistsExpression(innerSelectExpression),
                    Expression.Constant(true),
                    Expression.Constant(false),
                    typeof(bool)));

            return(TransformClientExpression <bool>(handlerContext));
        }