• 一些有意思的库


    FluentValidation

    https://github.com/JeremySkinner/FluentValidation

    using FluentValidation;

    public class CustomerValidator: AbstractValidator<Customer> {
    public CustomerValidator() {
    RuleFor(customer => customer.Surname).NotEmpty();
    RuleFor(customer => customer.Forename).NotEmpty().WithMessage("Please specify a first name");
    RuleFor(customer => customer.Discount).NotEqual(0).When(customer => customer.HasDiscount);
    RuleFor(customer => customer.Address).Length(20, 250);
    RuleFor(customer => customer.Postcode).Must(BeAValidPostcode).WithMessage("Please specify a valid postcode");
    }

    private bool BeAValidPostcode(string postcode) {
    // custom postcode validating logic goes here
    }
    }

    Customer customer = new Customer();
    CustomerValidator validator = new CustomerValidator();
    ValidationResult results = validator.Validate(customer);

    bool validationSucceeded = results.IsValid;
    IList<ValidationFailure> failures = results.Errors;

  • 相关阅读:
    Less34-Less37 (宽字节注入)
    宽字节注入 Less32-Less33
    Less29(jspstudy)-Less31
    Less26-Less28a
    Less23-Less25a(24--二次注入)
    Less 11-22
    sqli-labs 1-10
    sqli-labs环境搭建与安装
    OSPF与ACL综合实例
    用分治法完成比赛操作
  • 原文地址:https://www.cnblogs.com/s5689412/p/6925938.html
Copyright © 2020-2023  润新知