Redefined DbContext and indicated the model on which I will work with the database:

  public class EFDbContext: DbContext { public DbSet<Article> Articles { get; set; } } 

I changed my Article model, deleted one field in the model and deleted the corresponding column from the database. In subsequent calls to the context, a SQL query is still executed for a non-existent field, which is why the error is:

Invalid column name

Tell me, what could be the error?

  • Code First Approach? Migrated did? - codename0082016
  • Yes, CodeFirst. I tried to activate the migration, but with the connected Ninject do not work. - Roman
  • one
    Make DropCreateDataBaseIfModelChanged - Andrey NOP
  • try to read - en.stackoverflow.com/questions/671743 something like that was discussed here. If it does not help, or it will not be clear, describe your Code First approach - how it is implemented ... - SergeyE
  • NInject should not affect, EF is not tied to it. - Mark Shevchenko

1 answer 1

Try to use code first correctly. I have no idea why it does not work the way you did, but maybe it is worth all the same to complete the migration?