internal override void Execute(RuleExecution execution)
        {
            Type leftType  = execution.Validation.ExpressionInfo(assignStatement.Left).ExpressionType;
            Type rightType = execution.Validation.ExpressionInfo(assignStatement.Right).ExpressionType;

            RuleExpressionResult leftResult  = RuleExpressionWalker.Evaluate(execution, assignStatement.Left);
            RuleExpressionResult rightResult = RuleExpressionWalker.Evaluate(execution, assignStatement.Right);

            leftResult.Value = Executor.AdjustType(rightType, rightResult.Value, leftType);
        }
Exemplo n.º 2
0
        internal static bool EvaluateBool(CodeExpression expression, RuleExecution context)
        {
            object result = RuleExpressionWalker.Evaluate(context, expression).Value;

            if (result is bool)
            {
                return((bool)result);
            }

            Type expectedType = context.Validation.ExpressionInfo(expression).ExpressionType;

            if (expectedType == null)
            {
                // oops ... not a boolean, so error
                InvalidOperationException exception = new InvalidOperationException(Messages.ConditionMustBeBoolean);
                exception.Data[RuleUserDataKeys.ErrorObject] = expression;
                throw exception;
            }

            return((bool)AdjustType(expectedType, result, typeof(bool)));
        }
 internal override void Execute(RuleExecution execution)
 {
     RuleExpressionWalker.Evaluate(execution, exprStatement.Expression);
 }