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

前端 未结 21 1501
情话喂你
情话喂你 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:48

    This error occurred to me when I made changes to my Model and did not make migration for the changes to update the database.

    If you have ever made changes to your model in Code First Migration Schema

    Don't forget to add migration

    add-migration UpdatesToModelProperites 
    

    The above command will read all the changes you have made in the model and will write it in the Up() and Down() methods.

    Then simply update your database using the below command.

    update-database
    

    This what worked for me.

提交回复
热议问题