I'm having a problem where it seems that EF is remembering the database model for a DbContext
class that I deleted. Here is a summary of what happened (all DbContexts
made with the "Code First from database" wizard):
- Create DbContext, name it
MyDbContext
- Use
MyDbContext
, works fine, eventually decide to restructure - Delete the
MyDbContext
file - Create a new DbContext, name it
DifferentDbContext
- Use
DifferentDbContext
, works fine - Rename
DifferentDbContext
toMyDbContext
Now, it starts throwing the
"The model backing the '
MyDbContext
' context has changed..."
Exception. Renaming it back to DifferentDbContext
(or any new name) makes it works fine again.
What I have tried:
- Clean project/solution
- Uninstall EF, clean project, reinstall EF
- Restart Visual Studio/computer
- Search solution and file system for usage of
MyDbContext
- Ensured connection strings are correct
My best guess is that there could be some old auto-generated EF code/cache, but I haven't managed to find anything. Has anyone else seen something like this or have an idea of what could be causing it?