Code First的Enabling Migrations

如果採 Code First 的開發方式,中途若追加欄位或異動資料庫,則會拋出例外錯誤訊息 :

”The model backing the 'XXXContext' context has changed since the database was created. 
Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).”


這時可以參考如下的部落格文章,建立並更新遷移檔,保持最新的資料結構版本。

Entity Framework - 使用Code First的Enabling Migrations

ASP.NET Identity 搭配 Entity Framework 啟用 Code First Migration

留言

這個網誌中的熱門文章

localDB 預設路徑

第一個專案頁面

sourceTree 返回任意歷史版本