I was wondering what everyone thinks of this. Is the code easy to follow? Or is there a better way to do this? By the way, this is how I am currently doing validation at the moment with ASP.NET MVC. I can follow it, but I am the one who wrote it. For some reason SO is removing the line breaks between the validators.
public override Validation<MemberCreate> ValidationRules()
{
var validation = new Validation<MemberCreate>();
validation.Add(x => x.Name)
.LengthBetween(
Config.Member.NameMinLength,
Config.Member.NameMaxLength,
Resources.Errors.LengthBetweenNotValid.Fmt(
Resources.Titles.Name,
Config.Member.NameMinLength,
Config.Member.NameMaxLength))
.Characters(Resources.Errors.CharactersNotValid.Fmt(Resources.Titles.Name));
validation.Add(x => x.EmailAddress).Email(
Resources.Errors.EmailNotValid.Fmt(
Resources.Titles.EmailAddress));
validation.Add(x => x.VerifyEmailAddress).Equal(
x => x.EmailAddress,
Resources.Errors.CompareNotValid.Fmt(
Resources.Titles.VerifyEmailAddress,
Resources.Titles.EmailAddress));
validation.Add(x => x.PassWord).LengthGreaterThan(
Config.Member.PassWordMinLength,
Resources.Errors.LengthGreaterThanNotValid.Fmt(
Resources.Titles.PassWord,
Config.Member.PassWordMinLength));
validation.Add(x => x.VerifyPassWord).Equal(
x => x.PassWord,
Resources.Errors.CompareNotValid.Fmt(
Resources.Titles.VerifyPassWord,
Resources.Titles.PassWord));
return validation;
}