how to I force EF to forget them?
You have to refresh the model from database.
Open the EF model, right-mouse click on background => Refresh model from database.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Setup:
I have a project using EF core 5.0 in a .net 5.0 project.
The project has a subclassed DbContext class which contains the list of DBSets and then the OnModelCreating which maps the classes to the appropriate tables.
There are no migrations.
Problem:
I removed 2 columns from one of the entities, but when EF queries the database it still adds these 2 columns to the query and I get an error saying invalid column .... The generated queries that show in the console output have the invalid columns.
I verified there are no references to either of these 2 columns in the code base or in any object in the database. I used the following query to check. I checked to see if there were any views etc.
select *
from sys.all_objects AO
join sys.all_columns AC on AC.object_id=AO.object_id
where ac.name like '%LocationId%' or ao.name like '%LocationId%'
order by ac.name
What causes it to remember these deleted columns and how to I force EF to forget them?
Thanks,
Billy Jacobs
how to I force EF to forget them?
You have to refresh the model from database.
Open the EF model, right-mouse click on background => Refresh model from database.