Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework: deleted SQL table is not removed from the model

Tags:

People also ask

How do I delete a table in Entity Framework?

To remove a table, simply remove the corresponding DbSet<MyClass> and any references to that class in other parts of your model and EF will add a DropTable to the migration automatically. If you are no longer using the class for non-Entity Framework purposes you can delete it.

How do I delete a table in EDMX?

In the . edmx, right-click in the area between tables and select Model Browser. It will open a file tree of all the tables contained in your model. Delete every instance of the table you changed in your database.

What is RemoveRange in Entity Framework?

RemoveRange(Object[]) Begins tracking the given entity in the Deleted state such that it will be removed from the database when SaveChanges() is called.


Seemingly simple thing got me completely frozen and I can't find anything on the Net about this:

I had a common many to many relationship in my db:

Table One + TableTwo + LinkingTable with 2 columns: TableOneID and TableTwoID

I deleted the LinkingTable and tried to update the model from database. Now I get error "Error 11007: Entity type 'LinkingTable' is not mapped."

Does anyone know what exactly this EF wants? Thank you!


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!