Validation Aspect

1- Create Your Fluent Validation Validator

2- Implement IValidable Interface in Your ViewModel.

3- Decorate the Method you want to validate with  [Validate(typeof(FirstViewModelValidator))] where FirstViewModelValidator is your fluent validator created in step 1.

4- Incase of Validation Failure the OnValidationFailed(string sender, IList<ValidationFailure> errors) while be invoked where the sender is the name of the method failed and errors are the error list

//If Validation Failed Method Will Not Be Called and On Validation Failed Will be Invoked
//Note That The Current Class Must Implement From IValidable
[Validate(typeof(FirstViewModelValidator))]
public void Login()
{
}
public void OnValidationFailed(string sender, IList<ValidationFailure> errors)
{
//Handle Vaildation Failure
}

Last edited Sep 7, 2014 at 9:02 PM by Ahmed1098, version 1