ASP.Net Core Entity Framework Error: Data may have been modified or deleted since entities were loaded

Last Reply 15 days ago By dharmendr

Posted 15 days ago

Greetings Sir,

There are so much hype on Net core yet to host it is a problem. After hours of searching about hosting .net core on Plesk 

I deployed a sample app with no DB context Context and it ran successfully, but when I add DB context it will start showing the default error page. I don't know what else to do prior to this problem.

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

Var findId = context.Customer.FindAsync(Id)
Context.Remove
Context.Save

Is running well on my local PC (Deleting the associated Customer Id.  But on the production server is a problem.

You are viewing reply posted by: dharmendr 15 days ago.
Posted 15 days ago

Hi Destinykid,

Check your object does it pass Primary Key Null. 

Your entity primary key field means Id is not set. It is zero. As you are trying to delete record so its Id key should have a value.