I am using EF 6.0.0 and .Net 4.5.
I am facing a very confusing issue. One of my colleagues and I are working on the domain model section of our project on two different clients. The problem is this:
1 - My colleagues and I start with an absolutely identical project, and we are fully synchronized with source control.
2 - When I change the model, for example, add the then property Add-Migration FromA, then Update-Databaseit works fine. The generated code file contains only one command, which should add a column.
3 - Meanwhile, after the update, dband before I register something in the source control, my colleague adds another property, and then Add-Migration FromA, then Update-Database. And guess what? This generated code file has a command to delete a newly added column.
I added another column using native Sql and, fortunately, the column will not be deleted.
I deleted the table __MigrationHistoryand the remove column was not generated.
I disabled the initializer Database.SetInitializer<MyContext>(null), did not succeed.
So, I assume that EF Migrationscompares the current model with the last stored in the table __MigrationHistory, and not the last local snapshot stored in the file .resx. I'm right? Any way to solve the problem?