
虽然不知道是什么意思,但是百度了一下以后,按着方法一步一步来,亲测有效
解决办法:在VS 点击工具->Nuget包管理器->程序包管理器控制台
输入:Enable-Migrations -Force

按照提示,哪个Context有问题就照着红色的字使用,比如:
输入:Enable-Migrations -ContextTypeName MvcCms.DAL.MappingContext
在项目里会出现Migrations文件夹,找到其中的类Configuration,在构造方法里将AutomaticMigrationsEnabled 改为 true

如果没问题的输入:Add-Migration Initial
输入:Update-Database
完成!
还有一种方法,没试,但是我加上了,以后再看是否有用,就是再Global.asax中加入下面两句

网友评论