예제 #1
0
        public override bool Validate(RuleValidation validation)
        {
            if (validation == null)
            {
                throw new ArgumentNullException("validation");
            }

            bool valid = true;

            if (_expression == null)
            {
                valid = false;

                string          message = string.Format(CultureInfo.CurrentCulture, Messages.ConditionExpressionNull, typeof(CodePrimitiveExpression).ToString());
                ValidationError error   = new ValidationError(message, ErrorNumbers.Error_EmptyExpression);
                error.UserData[RuleUserDataKeys.ErrorObject] = this;
                validation.AddError(error);
            }
            else
            {
                valid = validation.ValidateConditionExpression(_expression);
            }

            return(valid);
        }