在Pluralsight课程中进行EF7迁移 [英] EF7 migration in Pluralsight course
问题描述
Shawn Wildermuth的Pluralsight课程使用ASP.NET Core RC1,MVC 6,EF7和AngularJS构建Web应用程序"中的第二次迁移是否还有其他问题?
Is anyone else having problems with the second migration in Shawn Wildermuth's Pluralsight course "Building a Web App with ASP.NET Core RC1, MVC 6, EF7 & AngularJS"?
具体来说,命令
dnx ef migrations add IdentityEntities
导致此异常:
GenericArguments[0], 'TheWorld.Models.IWorldRepository', on 'Microsoft.Data.Entity.Infrastructure.IDbContextFactory`1[TContext]' violates the constraint of type 'TContext'.
第一次迁移和数据库创建似乎进展顺利,所以我不确定是什么原因造成的.
The first migration and database creation seemed to go fine, so I'm not sure what's causing this.
推荐答案
我刚刚通过从解决方案资源管理器中删除整个Migrations文件夹来解决此问题.我不确定导致此错误的确切原因,但我认为,如果将迁移命名为同一事物(在您的情况下为IdentityEntities),则很可能会出现问题.
I just fixed this by deleting the entire Migrations folder from Solution Explorer. I am not sure exactly what causes this error, but I think if you name your migrations the same thing (IdentityEntities in your case) the problem is likely to occur.
这篇关于在Pluralsight课程中进行EF7迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!