Ejemplo n.º 1
0
 public BinaryExpressionFilter(string left, string op, string right)
 {
     LeftExpression    = left;
     RightExpression   = right;
     MyLeftExpression  = Expression.Property(MyParameterExpression, left);
     MyRightExpression = BinaryOperatorFactory.CreateConstantExpression(MyLeftExpression, right);
     TryChangingOperator(op, MyRightExpression);
 }
Ejemplo n.º 2
0
 public bool TryChangingRightExpression(string right)
 {
     try
     {
         var exp = BinaryOperatorFactory.CreateConstantExpression(MyLeftExpression, right);
         if (TryChangingOperator(Operator, exp))
         {
             MyRightExpression = exp;
             RightExpression   = right;
             // have to reset the expressionfunc
             SetExpressionFunc();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        private bool TryChangingOperator(string op, ConstantExpression rightExp)
        {
            try
            {
                var exp = BinaryOperatorFactory.CreateBinaryExpression(MyLeftExpression, op,
                                                                       rightExp);
                if (exp == null)
                {
                    return(false);
                }

                MyBinaryExpression = exp;
                Operator           = op;
                SetExpressionFunc();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }