Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

New Post: Possible to use same model validate two times?

$
0
0
Hi guys,the first time use fv.I want to validate like this,but for me the first validator is not working fine:(.do you have any good idea? thanks.
public class MyModel
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int Gender{ get; set; }
    public string Model{ get; set; }
}
public class FirstValidator : AbstractValidator<MyModel>
{
    public SaveModelValidator()
    {
        RuleFor("123");
    }
}

public class SecondValidator : AbstractValidator<MyModel>
{
    public PeriodModelValidator()
    {
        RuleFor("456");
    }
}

Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>