如何在EF,VS2013中启用迁移 [英] How do I enable migrations in EF, VS2013

查看:134
本文介绍了如何在EF,VS2013中启用迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在浏览教程@ ASP.NetContoso大学和我的软件包管理器控制台不允许我启用 - 迁移。



这是我输入的命令:



enable-migrations -ContextTypeName ContosoUniversityModelBinding.Models.SchoolContext



这是我从中得到的消息软件包管理器控制台:



在程序集'ContosoUniversityModelBinding'中找不到上下文类型'ContosoUniversityModelBinding.Models.SchoolContext'。



我已经按照教程中的每条指令进行操作。请帮忙。我在网上找不到任何关于此的信息。

I'm running through the tutorial @ ASP.Net "Contoso University" and my Package Manager Console does not allow me to "Enable-Migrations".

This is the command I'm typing in:

enable-migrations -ContextTypeName ContosoUniversityModelBinding.Models.SchoolContext

This is the message I'm getting from the Package Manager Console:

The context type 'ContosoUniversityModelBinding.Models.SchoolContext' was not found in the assembly 'ContosoUniversityModelBinding'.

I've followed every instruction in the tutorial. Please help. I cannot find any information on the web about this.

推荐答案

代码中的错误是你没有创建你传递的SchoolContext enable-migrations命令的值。这是必需的。



请创建一个,或者如果(正如您已经提到的那样)遵循本教程,那么首先至少尝试在办法。然后,创建自己的框架来使用。然而,第一步是遵循教程。他们将解释代码中的东西是如何工作的。
The error in your code, is that you have not created the "SchoolContext" which you are passing as a value to the enable-migrations command. Which is a required one.

Please create one, or if (as you've already mentioned) are following the tutorial, then first atleast try to follow them on the way. And then, create your own framework to work with. The first step however, will be to follow the tutorial. They will explain how the stuff works in the code.


这篇关于如何在EF,VS2013中启用迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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