6

What advantage does the FluentValidation library have over the .NET System.ComponentModel.DataAnnotations?

Does it offer more flexible validation as it is not annotated (static field validation) on the property like validating a property depending on another's property value?

Carey Gregory
  • 6,836
  • 2
  • 26
  • 47
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
  • 1
    possible duplicate of [Fluent Validation vs. Data Annotations](http://stackoverflow.com/questions/6807472/fluent-validation-vs-data-annotations) – wonea Apr 09 '14 at 11:57

1 Answers1

4

I'm not sure about data annotations but we've used FluentValidation for validation part in business logic. And easy integrating with ASP.NET MVC is nice bonus :)

It supports a lot of built-in rules, error messages localization, using object data in error messages, custom validation methods, conditional validation - applying some rules if object data matches a condition, rule sets - apply named set of rules, validation of aggregated objects and collections - and property names would be compatible with ASP.NET MVC property names and so on.

STO
  • 10,390
  • 8
  • 32
  • 32