2013-04-16 84 views
2

如何在Visual Studio 2012中的WebForms網站項目(而不是Web應用程序項目)中啓用實體框架?如何在ASP.NET WebForms網站項目中啓用實體框架

編輯1:我正在使用Framework 4.0。我已經使用軟件包管理器控制檯安裝了Entity Framework 5.0。在程序包管理器控制檯中執行啓用遷移時,會引發錯誤。

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)) 
+0

?這些將決定您目前的EF支持水平。您也可以單獨下載更新到EF。 – pseudocoder

+0

Visual Studio 2012(有問題說)。我安裝了所有框架。我需要它與Framework 4.0一起工作。 – PussInBoots

回答

0

請檢查您是否安裝了實體框架。如果沒有,請讓EF運行時可用上的NuGet

檢查這些鏈接,您正在使用什麼版本的Visual Studio(如果有的話),以及什麼是.NET Framework的最新版本已安裝NugetSample Application

+0

我已經使用軟件包管理器控制檯安裝了Entity Framework 5.0。 – PussInBoots

相關問題