How to rename a database column in Entity Framework 5 Code First migrations without losing data?

后端 未结 8 2110
北海茫月
北海茫月 2021-01-30 10:25

I got the default ASP.NET MVC 4 template successfully running with EF 5.0 Code First Migrations. However, when I update a model property name, the corresponding table column dat

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 10:34

    Manually edit the Up and Down methods of the migration to use the RenameColumn method to replace the AddColumn and DropColumn that it automatically generates for you.

提交回复
热议问题