I am writing an MVC app over an existing database. I set up all my models and created my own dbcontext file and started doing some controller and view work, then someone discovered a table in the underlying SQL database was created by mistake and deleted it. Now when my controller executes a dbcontext.savechanges() for a different table, I get an error message >"Invalid object name 'deletedTable'"
That table was never used in my app, and doing a simple find in Visual Studio for the entire solution, 'deletedTable' isn't found anywhere.
I suspect somewhere along the line entity framework took a snapshot of the underlying database and now that is out of synch with the real database, however I don't know where that snapshot is or how to force it to refresh.
Or I'm completely wrong.
So this basically magically fixed itself when I came back to it a few days later. I suppose whatever had the snapshot was just in memory somewhere.
EDIT
Actually turned out what I thought was magic was someone on the DB team finding a SQL trigger that was still trying to act on the deleted table, once that trigger was removed the problem was solved.