예제 #1
0
        protected internal override void DoValidate(object objectToValidate,
                                                    object currentTarget,
                                                    string key,
                                                    ValidationResults validationResults)
        {
            bool isValid = false;

            if (objectToValidate != null)
            {
                RangeChecker <int> checker = new RangeChecker <int>(this.lowerBound, this.upperBound);
                isValid = checker.IsInRange((int)objectToValidate);
            }

            if (isValid == false)
            {
                RecordValidationResult(validationResults, this.MessageTemplate, currentTarget, key);
            }
        }
예제 #2
0
        protected override void DoValidate(object objectToValidate,
                                           object currentTarget,
                                           string key,
                                           ValidationResults validationResults)
        {
            bool isValid = false;

            if (objectToValidate != null)
            {
                RangeChecker <int> checker = new RangeChecker <int>(this.lowerBound, this.upperBound);
                isValid = checker.IsInRange(Encoding.Default.GetByteCount(objectToValidate.ToString()));
            }

            if (isValid == false)
            {
                RecordValidationResult(validationResults, this.MessageTemplate, currentTarget, key);
            }
        }