I'm working on a project using entity framework 6 code first and I am trying to work out the correct way to drop a now obsolete table from the database. There doesn't seem to be much information about this on the web, I know I could simply remove the dbset from my dbcontext, remove the migration file for it and the row from the migrations table in the db but I just wanted to see if that was the only way as this seems a lot of messing about?
If I understood correctly you are using migrations as well, so it would not be a good idea to simply remove a migration file as it would break the databases that has the newest migrations.
Instead create another migration step after you removed the related DbSet from the DbContext and of course all references of the entity, that has a T parameter of the DbSet, from other entities that are still in the database.
And when you create this new migration step, voila a DropTable(...) migration operation will appear in the Up() function that will remove this table.
I think this is the cleanest and easiest solution for your problem :)
This is a little retro, but try the following. In this example, db is the database context and A is the table name:
db.Database.ExecuteSqlCommand("drop table A");
Seemed to work for me.