Example #1
0
        public override Expression <Func <T, bool> > ToExpression()
        {
            var leftExpression  = _left.ToExpression();
            var rightExpression = _right.ToExpression();
            var paramExpr       = Expression.Parameter(typeof(T));
            var exprBody        = Expression.OrElse(leftExpression.Body, rightExpression.Body);

            exprBody = (BinaryExpression) new ParameterReplacer(paramExpr).Visit(exprBody);
            var finalExpr = Expression.Lambda <Func <T, bool> >(exprBody, paramExpr);

            return(finalExpr);
        }
        public override Expression <Func <T, bool> > ToExpression()
        {
            var specExpression = _spec.ToExpression();

            var paramExpr = Expression.Parameter(typeof(T));
            var exprBody  = Expression.Not(specExpression.Body);

            var visitedExpr = new ParameterReplacer(paramExpr).Visit(exprBody);
            var finalExpr   = Expression.Lambda <Func <T, bool> >(visitedExpr, paramExpr);

            return(finalExpr);
        }