Pluralsight 课程中的 EF7 迁移 [英] EF7 migration in Pluralsight course

查看:34
本文介绍了Pluralsight 课程中的 EF7 迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有其他人在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆