I am getting this error \"The object cannot be deleted because it was not found in the ObjectStateManager.\"
My code is:
protected MyEntities sql
In case none of the above worked, you may try this solution:
context.Entry(yourObject).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges();