EF Data migrations won't detect changes when adding new migration

后端 未结 16 1911
情话喂你
情话喂你 2020-12-09 14:53

I am using Entity Framework 5.0 Data migrations along with code first. When i add a new field to my model and execute the following command in the package manager console.

16条回答
  •  庸人自扰
    2020-12-09 15:16

    I added a new class to my data model to a sub-directory, the resultant namespace was not visible to scaffolding using add-migration.

    Fix was to rename the namespace of the new class to conform to the rest of model, and/or add "public virtual DbSet .." etc into your entity context class, which will require you to reference this new namespace, then run add-migration again.

提交回复
热议问题