Most of you might have used Data Annotations for server-side model validations. We use data annotations to apply validations on public properties of the entity/model class so that when the view is submitted, these model validations are executed.
Although Data Annotations are good, we have some limitations, e.g. the Data Annotations are bound to the properties so performing conditional validations is difficult.
To implement conditional validations, we need to write logic in controller and execute it. This is where we need to think of an alternative to the Data Annotations. Fluent Validation is a cool solution we have for performing validations on model classes.
Fluent Validation is a .NET library for building strongly-typed validation rules. It has support from .NET Framework v4.6.1+ and .NET Core v2.0 onwards.