一个本来运行正常的项目,不知道 为啥CodeFirst就不好使了,
报错:No DbContext was found in assembly 'UserMicroservice'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
网上也查了各种答案,什么EF和EFCore两个类库并存了,我这项目不存在这个总是。
最后,竟然通过 add-migration initial 解决了。
我是真的很奇怪,也很无语,为什么 需要初始化。。。真的没搞明白,希望懂的朋友留言讲解一下。3Q
事后:又仔细观察 了一下__EFMigrationsHistory 表,发现版本变了。所以导致 要重新初始化!(据我自己推断)