banco-alimentar / alimentestaideia.pt

Site doações alimente esta ideia
http://alimentestaideia.pt
Other
10 stars 0 forks source link

Investigate exception - database operation was expected to affect 1 row #740

Open tiagonmas opened 1 year ago

tiagonmas commented 1 year ago

Describe the bug Investigate this error from App Insights "The database operation was 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. "

guerrerotook commented 1 year ago

This is very difficult to investigate, those are updates where we update something but there wasn't anything to update. Since we are using Entity Framework and we have the possibility to set a entity to be changed, then EF will try to update and that may cause this issue. We need to enable the logging of the SQL Queries in order to investigate this more.