示例#1
0
        public IEnumerable <CheckFailure> Checker(PropertyCheckContext <T, TProperty> context)
        {
            if (context.PropertyValue.CompareTo(valueToCompare) >= 0)
            {
                Succeed = false;

                return(new[] { new CheckFailure {
                                   PropertyName = context.PropertyName,
                                   ErrorMessage = $"The value of {context.PropertyName} must less then {valueToCompare}"
                               } }.AsEnumerable());
            }

            return(Enumerable.Empty <CheckFailure>());
        }
示例#2
0
        public IEnumerable <CheckFailure> Checker(PropertyCheckContext <T, TProperty> context)
        {
            if (context.PropertyValue == null || context.PropertyValue.Equals(@default))
            {
                Succeed = false;

                return(new[] { new CheckFailure {
                                   PropertyName = context.PropertyName,
                                   ErrorMessage = $"The value of { context.PropertyName } connot be empty"
                               } }.AsEnumerable());
            }

            return(Enumerable.Empty <CheckFailure>());
        }