Fluent Validation vs. Data Annotations

SiberianGuy picture SiberianGuy · Jul 24, 2011 · Viewed 27.3k times · Source

What are the operative differences between these two validation packages when used for ASP.NET MVC validatation? They seem to have similar objects, all the way to their object names. Is one related to another? What are their differences? In what way do these differences denote different use cases?

Answer

Darin Dimitrov picture Darin Dimitrov · Jul 24, 2011

I prefer Fluent Validation:

  1. It gives me far better control of my validation rules
  2. Doing conditional validation on different properties is so much easier compared to Data Annotations
  3. It separates the validation from my view models
  4. Unit testing is far easier compared to Data Annotations
  5. It has excellent client side validation support for most standard validation rules