0

I am using MVC 4 with Code First and just starting to use the Fluent API, but I can't find anywhere where it is mentioned how to provide validation error messages? Can this only be done by using Data Annotations?

1
  • One important thing to keep in mind is that you are talking about validation of the data model, which may be different from validation of the model in your user interface. For instance, you may have a field that is nullable in your database, but you require it in your UI. If you put a Required attribute on the data model, it will also require that the field in the database be non-nullable. Commented Oct 18, 2012 at 16:28

1 Answer 1

2

On possibility is to use Data Annotations. Another possibility is to use a differehnt validation framework such as FluentValidation.NET which allows you to specify the error message in your validator rules.

Sign up to request clarification or add additional context in comments.

2 Comments

Does FluentValidation.NET allow for localization of error messages?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.