I am using Entity Framework with automatic transitions.
Therefore, when I add a new model to my context, my database is updated and a new table is created.
What I want to do is the opposite, completely selecting a table from the database. However, removing the definition from the Context class does not work.
public class CompanyContext : DbContext { public DbSet<Permission> Permissions { get; set; } public DbSet<Company> Companies { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } }
For example, I want to delete the Company table from the database. To do this, I remove the Companies property from the CompanyContext class. However, it does not work.
What is the correct way to delete tables in EF and, if possible, using automatic migration?
c # entity-framework database-migration ef-code-first ef-migrations
emre nevayeshirazi
source share