This question states that if Entity Framework and code first is used, some default validation is performed. I am using Entity Framework database-first and would like to use MVC 3 unobtrusive javascript validation. Is there some default validation that will be performed, such as client-side checking for numbers when the database column is INTEGER, or client-side checking of string length against VARCHAR column lengths?
This question states that if Entity Framework and code first is used, some default
Share
There should be no client side check unless you add the jQuery.
There are some default checking: DateTime field is always required. I don’t have a complete list though.
For code first, you have detailed data annotation already in place, which specifies each field in the database. This annotation will enable a lot of default validation.
However, if it is database first, all you get from the EF is a group of partial classes (corresponding to the tables) with no annotation. The data annotation is usually added in a separate metadata file. Without this extra annotation, no default validation is there. EF simply hands the task of annotation to the programmer.