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

后端 未结 4 576
迷失自我
迷失自我 2021-01-17 14:29

I am trying to use Code First with Migrations. Even though there are no current changes to my model, I\'m getting an exception. When I add a migration, the up and down are e

4条回答
  •  春和景丽
    2021-01-17 15:08

    I am not sure if you found the answer to your problem, but this other answer I found here actually did it for me: Entity Framework model change error

    I actually ended up deleting the __MigrationHistory table in SQL Server which I didn't know it was being created automatically.

    The article also talks about the option to not generate it I think by using this instruction: Database.SetInitializer(null); but I have not used it, so I am not sure if it works like that

提交回复
热议问题