2

如何在 Visual Studio 2012 的 WebForms 网站项目(不是 Web 应用程序项目)中启用实体框架?

编辑 1:我使用的是 Framework 4.0。我已经使用包管理器控制台安装了 Entity Framework 5.0。在包管理器控制台中执行 Enable-Migrations 时会抛出错误。

PM> enable-migrations
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Server stack trace: 
   at EnvDTE.Properties.Item(Object index)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at EnvDTE.Properties.Item(Object index)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName)
   at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName)
   at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName)
   at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
4

1 回答 1

0

请检查您是否安装了实体框架。如果没有,请在 NuGet 上获取 EF 运行时可用

检查Nuget示例应用程序的这些链接

于 2013-04-16T12:58:06.583 回答