Ejemplo n.º 1
0
        public ExpressValidator([NotNull] Action <ExpressValidationBuilder <T> > builder)
        {
            var rules = new ExpressValidationBuilder <T>();

            builder(rules);
            _rules = rules.Build();
        }
Ejemplo n.º 2
0
 public static ExpressValidationRuleBuilder <T> NotNull <T>(this ExpressValidationBuilder <T> builder)
 {
     return
         (builder
          .False(CreateEqualNullExpression <T>())
          .WithMessage($"{typeof(T).ToPrettyString()} must not be null.")
          .BreakOnFailure());
 }
Ejemplo n.º 3
0
 public static ExpressValidationRuleBuilder <T> Null <T, TMember>(this ExpressValidationBuilder <T> builder, Expression <Func <T, TMember> > expression)
 {
     return
         (builder
          .True(CreateEqualNullExpression(expression))
          .WithMessage($"{typeof(TMember).ToPrettyString()} must be null.")
          .BreakOnFailure());
 }
Ejemplo n.º 4
0
 public static ExpressValidationRuleBuilder <T> False <T>(this ExpressValidationBuilder <T> builder, Expression <Func <T, bool> > expression)
 {
     return(builder.True(Negate(expression)));
 }