如何启用实体框架的ASP.NET WebForms的网站项目 [英] How to enable Entity Framework in a ASP.NET WebForms Website Project
问题描述
你如何在Visual Studio 2012支持实体框架中的WebForms网站项目(而不是Web应用程序项目)?
编辑1:我使用框架4.0。我已经使用包管理器控制台安装实体框架5.0。当执行启用,在迁移软件包管理器控制台,它抛出和错误。
PM>允许的迁移
System.ArgumentException:参数不正确。 (异常来自HRESULT:80070057(E_INVALIDARG))服务器堆栈跟踪:
在EnvDTE.Properties.Item(对象索引)
在System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr的MD,对象[] ARGS,对象服务器,对象[]&安培; outArgs)
在System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(即时聊天MSG)[0]时异常重新抛出:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天reqMsg,即时聊天retMsg)
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; MSGDATA,的Int32型)
在EnvDTE.Properties.Item(对象索引)
在System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue [T](工程项目,弦乐propertyName的)
在System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(字符串configurationTypeName)
在System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(字符串contextTypeName)
在System.Data.Entity.Migrations.EnableMigrationsCommand<方式>&c__DisplayClass2 LT; .ctor> b__0()
在System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(动作命令)
参数不正确。 (异常来自HRESULT:80070057(E_INVALIDARG))
请检查您是否已经安装了实体框架与否。如果没有,请让EF运行时可用上的NuGet
检查这些链接的NuGet 和<一个href=\"http://programmaticponderings.word$p$pss.com/2012/11/22/first-im$p$pssions-of-database-first-development-with-entity-framework-5-in-visual-studio-2012/\"相对=nofollow>示例应用程序
How do you enable Entity Framework in a WebForms Website Project (not Web Application Project) in Visual Studio 2012?
Edit 1: I'm using Framework 4.0. I have installed Entity Framework 5.0 using the Package Manager Console. When executing Enable-Migrations in Package Manager Console it throws and error.
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))
Please Check whether you have installed Entity Framework or not. If not Please get EF Runtime Available on NuGet
Check these Links for Nuget and Sample Application
这篇关于如何启用实体框架的ASP.NET WebForms的网站项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!