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

前端 未结 13 624
旧巷少年郎
旧巷少年郎 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:24

    Adding this as another possible solution, because this is what fixed it in our case;

    Make sure if you have multiple projects that they are using the same Entity Framework Nuget package version!.

    In our case we had one project ( call if project A ) holding the EF code first context with all entities. It was this project that we were using to add migrations & update the database. However a second project ( B ) was referencing project A to make use of the context. When running this project we got the same error;

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

提交回复
热议问题