I am maintaining a WPF application that use Entity Framework Code First with migrations (not auto). Some of the POCOs in this application are mapped to views (that point to another DB). I guess the method used to do this is similar to what is done in this answer: how to use views in code first entity framework
Now I want one of the POCOs (Company) to point to a table in stead of a view. The POCO has also changed a bit since pointing to the view.
When I add a migration after doing the changes in the POCO and in the CompanyConfiguration-class (changing the ToTable()), then it seems that the migration think that the view is an existing table and tries to rename it. For example the start of the Up()-method will look like this:
RenameTable(name: "dbo.vCompany", newName: "Company");
AlterColumn("dbo.Company", "ParentAccount", c => c.String(maxLength: 160));
AlterColumn("dbo.Company", "Country", c => c.String(maxLength: 100));
However, I don't want the view to be changed, I want the Company-table to be created from scratch matching the POCO. What would be the correct/good way to accomplish this? Is it possible without writing the Up() and Down() methods myself?
Currently the application uses Entity Framework 6.1, but when this Company/vCompany mapping was first created, it was version 4.3 I belive.