Пример #1
0
        public void Configure(ValidatorBuilder <T> builder)
        {
            var elementBuilder = new TypeValidatorBuilder <TElement>();

            _configurator.Configure(elementBuilder);

            Validator <TElement> elementValidator = elementBuilder.Build("");

            var nestedValidator = new NestedValidator <TElement>(elementValidator);

            var validator = new EnumerableValidator <T, TElement>(nestedValidator);

            builder.AddValidator(validator);
        }
Пример #2
0
        public void Configure(ValidatorBuilder <T> builder)
        {
            var propertyValidatorBuilder = new TypeValidatorBuilder <TProperty>();

            foreach (var configurator in _configurators)
            {
                configurator.Configure(propertyValidatorBuilder);
            }

            Validator <TProperty> propertyValueValidator =
                propertyValidatorBuilder.Build("." + GetPropertyName(_propertyExpression));

            var validator = new PropertyValidator <T, TProperty>(_propertyExpression, propertyValueValidator);

            builder.AddValidator(validator);
        }