简体   繁体   中英

Entity Framework with Database First model

I am developing in ASP.NET MVC with EF 4.1 with Data Annotations. The client side validation is working as expected. But I have this doubt. For example when a required field (example: product name) , goes null from the client to server and if the entity model is throwing exception. How can I handle this case?

Some additional info is that, I consume the EF via WCF service layer

You should be validating the model on the server side/controller too by calling model.isvalid, for more info on MVC server side validation:

http://msdn.microsoft.com/en-us/library/dd410404(v=vs.90).aspx

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM