Exemplo n.º 1
0
        public void IgnoreValidation <TProperty>(Expression <Func <TDto, TProperty> > propertyValue)
        {
            var memberName = ((MemberExpression)propertyValue.Body).Member.Name;

            var validator = new DtoValidatorItem <TProperty>(memberName, null, null, EqualityValidator);

            _validations.Add(validator.Name, validator.Validate);
        }
Exemplo n.º 2
0
        public void AddValidation <TProperty>(Expression <Func <TDto, TProperty> > propertyValue, TProperty value)
        {
            var memberName = ((MemberExpression)propertyValue.Body).Member.Name;

            var validator = new DtoValidatorItem <TProperty>(memberName, propertyValue.Compile().Invoke(_entity), value, EqualityValidator);

            _validations.Add(validator.Name, validator.Validate);
        }