This project is read-only.

Better Validation Report

Nov 17, 2011 at 8:21 AM

Usually have validation result as bool is not usefull. Most of the time we need to provide some details where exactly problem is.
I would like to see a validation report or result like this.

ValidationResult r.

	foreach(var e in r.Errors)
		//get e.Property
		//get e.ErrorMessage

I didn't find how to achieve that with this framework. The closest solution could be to use PropertyValidationReport but it is not realy convenient because afterwards we need to test each property manually.

May be set error message as part of the setup would also be useful in this context.

Overall good job and nice framework. 

Dec 10, 2011 at 12:45 PM

Thanks for the comment,

An e.ErrorMessage wont be made available. This is to preserve the single responsibility of the Validation Report, which is to collect validation errors.

To display an error to the user, you will have to use an error message resolver.

The error resolver will give you power to have multi-language errors or contextual error messages.

Combining ErrorMessageResolver and ValidationReport will loose you that flexibility...