I was looking for the way to do data validation for my church library management system, there are some good frameworks around. But I found they need to bind with other libraries. After I had spent some time to look around, then I found a library, calls Fluent Validation. They are very simple.
The validation can be done in this way:
Code:
ResourceValidator validator = new ResourceValidator(); | |
ValidationResult results = validator.Validate(Resource); | |
| |
if(!results.IsValid){ | |
IList<ValidationFailure> failures = results.Errors | |
..... Do the error handling | |
} |
That is so simple, that is what I like!
Moreover, I downloaded their source codes. The structure and code are very very readable!
Lastly, it can be integrated with ASP.Net MVC!
Recent comments