EF 4 Code First: Model compatibility cannot be checked because the EdmMetadata type was not included in the model

前端 未结 3 1946
刺人心
刺人心 2020-12-11 01:49

I am trying to use EF 4 Code First pattern. My initialization code is as follows:

Create Model Builder:

private static DbModelBuilder CreateModelBuil         


        
3条回答
  •  自闭症患者
    2020-12-11 02:36

    Removing IncludeMetadataConvention means the initializer cannot tell when the model changes. Adding it back in won't help either because it only creates the meta data table on db creation, which obviously won't exist for preexisting databases or databases that were created with the convention disabled.

    Solution is dropping the database and enabling the convention, or disabling the initializer and updating the database another way (manual or ef migrations)

提交回复
热议问题