For more information about ASP.. net mvc uses the EF Code First method to read the Validation failed for one or more entities of the database. see & #39; EntityValidationErrors & #39; property for more details .,

Source: Internet
Author: User

About the Validation failure for one or more entities. See 'entityvalidationerrors' property for more details when EF Code First is used in ASP. net mvc to read the database .,

Today, I encountered a lot of problems when I was building a small website. Alas, I am a newbie and I don't know much about it. Today, the button for submitting a form cannot be used, and it took a few hours. However, I finally got it done. There are also browser developers, or I don't know how long it will take for me to continue troubleshooting. Another problem occurred when I saved the data to the database this evening. I am using the Code First mode of Entity Framework to access the database. For data verification, I added data annotations to the data model. Of course, some JS is introduced in the front end so that the verification function can be completed when data is not submitted to the server. When saving the data submitted by the user in the background, we need to use the ModelStatus. IsValid attribute. Is to determine whether the model status is valid. If all the data entered by the user meets the conditions in the Data annotation of the data model, ModelStatus. isValid = true; otherwise, ModelStatus. isValid = false when ModelStatus. when IsValid = true, that is, the data is valid, we save the data to the database. But today I encountered an exception while saving and saving the data. For example.

But I cannot find the error. This statement indicates that one or more entity verification fails. For details, see entity verification error attributes. But how can I find this entity verification error. In fact, we can use tr and Catch in C # to Catch this exception. We will know where the error is. For example. Because VS2015 is intelligent. Move the mouse to see the value. For example. We can find this error as prompted. Because I am a cainiao. So please point out something wrong.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.