还有其他人在 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 迁移
发布评论