ASP. NET Core Operational myths

Source: Internet
Author: User

Prompt data change error on update

In the update event prompted the following error, found on the internet, most of it is a conflict, but only one client in the test at the same time, there should be no conflict issues, and later found that the editor loading ID, and the update submitted when the ID is different, the original is not on the editing interface for ID write bound fields, It should be found that the ID is empty at commit time, and the new ID is generated automatically.

The ID is the primary key, using the automatically generated GUID.

In the editing of the main field is still not missing ah ...

Database operation expected to affect 1 row (s) but actually affected 0 row (s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/? linkid=527962 for information on understanding and handling optimistic concurrency exceptions.

About Modelstate.isvalid

The model's properties are always true if they are not validated, and false if the validation-related attribute is modelstate.isvalid, and modelstate.isvalid is not satisfied.

Modelstate.isvalid will also be false when a parameter attribute type is received that does not match the model definition.

You can use the following code to query for specific errors

if(!modelstate.isvalid) {varmsg =string.                Empty; foreach(varValueinchmodelstate.values) {if(value.) Errors.Count >0)                    {                        foreach(varErrorinchvalue. Errors) {msg= msg +error.                        errormessage;                }}} Console.WriteLine (msg); returnPage (); }

ASP. NET Core Operational myths

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.