The model backing the 'ApplicationDbContext' context has changed since the database was created

前端 未结 21 1437
情话喂你
情话喂你 2020-12-02 07:24

First of all, I have not seen this error anywhere else and I guess it\'s not a replicate so please read the whole situation first.

Everything was working just fine

21条回答
  •  执笔经年
    2020-12-02 07:46

    I know I am very late, but I want to give contribution too. This error is really strange, because the browser is not able to understand how the changes should be rendered because the classes and their properties might have changed but not committed to the database.

    So do one thing,

    create one migration in Package Manager Console(Tools > NuGet Package Manager > Package Manager Console) using this command:

    add-migration UpdateMigration

    where UpdateMigration is the name of your Migration. You can give it any name of your choice but please be specific.

    After that, we just need to update the database, so run this:

    update-database

    Now that you have committed your changes to the database, just refresh your browser and there you go!

    Hope this helps.

提交回复
热议问题