In EF Code first, I want to drop one column from one table & then delete another table.
After removing one column from class file, automatically one migration file generated.
But how to delete table.
what command need to fire? Do I need to delete complete class file & also remove following line from Context file?
public DbSet<TableClassName> TableClassNameSet { get; set; }
I use, Add Migration 'TableClassName' command.
So what is best way to remove table?
If you just made the changes in the last migration, you can rollback that migration. Otherwise, just adjust your models and the changes will be picked up in the next migration. 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.