This article is a mirror article of machine translation, please click here to jump to the original article.

View: 18928|Reply: 0

[Source] An entity object cannot be referenced by more than one IEntityChangeTracker instance.

[Copy link]
Posted on 11/6/2017 12:53:10 PM | | | |


Excerpt from the CSDN:
Problem: After updating one of the fields of an object, it is updated into the database and this error is reported.
Solution: Retake the object from the database, update the fields to be changed, and save it to the database.

Excerpt from cnblog:
http://www.cnblogs.com/oneword/archive/2012/03/18/2404967.html ;

Excerpt from CSDN
http://blog.csdn.net/sb1ue/article/details/7024888 ;

The above methods are to find the original Entity entity object from the database again, and then perform the operation. However, such a method is not recommended. The cause of this issue is "there are multiple DBContext context objects in the current thread", which may be a new DBContext object every time you perform an operation in your DAL layer. The solution is to use singleton mode to ensure that there is only one DBContext object in the thread.




Previous:datatables table demo link
Next:{:1_7:} {:1_9:}
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com