Model backing a DB Context has changed; Consider Code First Migrations

前端 未结 13 520
旧巷少年郎
旧巷少年郎 2020-12-02 09:54

The model backing the \'MyDbContext\' context has changed since the database was created. Consider using Code First Migrations to update the database (http://

相关标签:
13条回答
  • 2020-12-02 10:38

    Just go to Package Manage Console, type the following:

    Enable-Migrations

    *If the error like this appears "Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration."

    Do this >>> Add-Migration

    *Visual studio will ask for a name, kindly input the name you want.

    Update-Database

    0 讨论(0)
提交回复
热议问题