標籤:
最近有個新項目想用EF來寫。從網上看了一些資料,學習了基本的CRUD方法,準備拿到手裡試一試。
開發環境是Visual studio 2010 SP1 發現好多方法對不上。更新到6.1.3還是不行。折騰了兩天發現應該是開發環境.NET 4.0 的問題。
stackoverflow上有人解釋
Entity framework 4.0 (System.Data.Entity.dll) is part of .NET 4.0. There is no separate download. EF 4.1 ad EF 4.2 are distribution of EntityFramework.dll (not System.Data.Entity.dll). EF 4.2 is only distributed as NuGet and is not installed to GAC.
Reverse Engineer Code First is not part of any of these tools. It is part of EF Power Tools CTP 1 which is most probably dependent on EF 4.1 (it was released prior to EF 4.2 and there is possibility that it doesn‘t work with EF 4.2). This tool itself has no relation to functionality of Entity framework.
使用EF還添加System.Data.Entity.dll這個,這個是來自.NET 4.0 的。網上的資料應該都是4.5的環境。公司內網伺服器上的環境還是4.0沒有更新。EF很多進階的新特性還是很動人的,這次還是用LINQ吧。
Entityframework 版本更新帶來的割裂感