Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My understanding : AFAIK, both IValidatableObject and IValidator interfaces validates the Model and helps displaying validation errors. The validate() method of IValidatableObject() returns an IEnumerable so that we can do multiple validations and display the validation results using the yield return pattern. Whereas the Validate() method of IValidator has a void return type and basically it sets the IsValid property and the ErrorMessage property. I guess we can do multiple validations here as well however the ErrorMessages has to be concatenated into a single property.

Are there any other differences/use cases that I'm missing?

P.S. This is an interesting idea I came across, however this is a custom interface and not something .Net offers. However, I am only concerned about what .Net offers by default.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900