andrebaltieri / Flunt

Validations and Notifications
https://github.com/andrebaltieri/flunt
MIT License
626 stars 162 forks source link

Make Contract be generic, instead of by injection. #4

Closed thiagolunardi closed 3 years ago

thiagolunardi commented 7 years ago

Then:

public class CustomerContract : Contract<Customer>
{
    public CustomerContract()
    {
        Contract
            .Requires()
            .HasMinLen(customer => customer.FirstName, 3, "FirstName", "First Name should have at least 3 chars")
            .HasMaxLen(customer => customer.FirstName, 3, "FirstName", "First Name should not have more than 3 chars")
            .HasMinLen(customer => customer.LastName, 3, "LastName", "Last Name should have at least 3 chars")
            .HasMaxLen(customer => customer.LastName, 3, "LastName", "Last Name should not have more than 3 chars");
    }
}
andrebaltieri commented 3 years ago

Thanks! Moved to version 2.0! Check the milestones!

andrebaltieri commented 3 years ago

Version 2.0.0 release! Thanks!