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

New Post: Validating properties with separate validators

$
0
0

If I have a class like:

 

class Credentials
{
public string Login { get; protected set; }
public string Password { get; protected set; }
}

and want to implement several validators for login, like, LoginAvailabilityValidator or LoginFormatValidator, what's the correct way to do so?
I need this because in some cases I need to validate Login alone, not as a part of Credentials (could be a bad design, but still, I'm curious).
Implementing AbstractValidator<string> doesn't seem right, I can't even use RuleFor.

 


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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