DropCreateDatabaseIfModelChanges EF6 results in System.InvalidOperationException: The model backing the context has changed

前端 未结 5 1234
后悔当初
后悔当初 2021-02-02 15:43

After migrating to Entity Framework 6 I get an error when executing unit tests on the build server.

I\'m using the DropCreateDatabaseIfModelChanges initiali

5条回答
  •  执笔经年
    2021-02-02 16:13

    It looks like this behavior was intended. Here's a quote from one of the developers:

    This change of behavior was by design because EF5 would create the database without using the defined migrations meaning that the database created by the initializer could be different to the one created by Migrations. This could lead to testing against one database schema but running in production against a different database schema. However, we have tentatively decided to make a change to this behavior and this is being tracked here: https://entityframework.codeplex.com/workitem/1709

提交回复
热议问题