c# - Entity Framework Migration: Why does it ignore snapshot and take __MigrationHistory into account? -
i'm using ef 6.0.0 , .net 4.5.
i face confusing problem. me , 1 of colleagues working on domain model section of our project on 2 different clients. problem is:
1- me , colleagues start absolutely identical project , synced source control.
2- when change model example add property add-migration froma update-database works great. generated code file contains 1 command add column.
3- meanwhile, after db updated , before check in source control, colleague adds property , add-migration froma update-database. , guess what? generated code file has command drop column newly added!!!
i added column using native sql, , fortunately column not going deleted.
i deleted __migrationhistory table , remove column didn't generated.
i turned off initializer database.setinitializer<mycontext>(null), no success.
so, guess ef migrations compares current model last 1 stored in __migrationhistory table not last local snapshot stored in .resx file. right? way solve problem?
Comments
Post a Comment