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

后端 未结 16 1934
情话喂你
情话喂你 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:15

    oops. In my case I was adding a new root entity not referenced by any other entity. The result was simply that code first had no reason to generate a migration for the entity. Once I added the code into the DbContext (a dbset) it worked like a charm.

提交回复
热议问题