Pluralsight 课程中的 EF7 迁移

编程入门 行业动态 更新时间:2024-10-25 06:26:16
本文介绍了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 迁移

本文发布于:2023-11-15 14:26:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1595248.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:课程   Pluralsight

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!