Figure 4: Invalid currency amount If you are using the Microsoft Entity Framework to generate your data model classes then you cannot apply the validator attributes directly to your classes.
Because the Entity Framework Designer generates the model classes, any changes you make to the model classes will be overwritten the next time you make any changes in the Designer.
NET MVC application, you first need to add a reference to the Microsoft. Figure 2: Adding the Create View Note Remove the Id field from the Create form generated by the Add View menu option.
Data assembly included with the Data Annotations Model Binder Sample download.
Because the Id field corresponds to an Identity column, you don't want to allow users to enter a value for this field.
It is important to understand that the Data Annotations Model Binder is not an official part of the Microsoft ASP. Although the Data Annotations Model Binder was created by the Microsoft ASP. Listing 2: Controllers\Product Finally, you can create the view in Listing 3 by right-clicking the Create() action and selecting the menu option Add View.
NET MVC team, Microsoft does not offer official product support for the Data Annotations Model Binder described and used in this tutorial. Create a strongly-typed view with the Product class as the model class.