是的EntityFramework适用于Windows 8商店应用程序?
时的EntityFramework适用于Windows 8商店应用?
Is EntityFramework available for Windows 8 Store Apps?
我在使用Visual Studio 2012 Express,用于Windows 8的
我开始怀疑,因为我不能使它工作。
I'm using Visual Studio 2012 Express for Windows 8. I'm starting to wonder because I can't make it work.
我是从的NuGet
安装实体框架包我加System.Data.Entity的和System.Data.Design到项目
I installed the Entity Framework package from NuGet I added System.Data.Entity and System.Data.Design to the project
但无论我做什么,的DbContext无法识别......
But no matter what I do, DbContext isn't recognized...
任何想法?
编辑:
的EntityFramework不适用于Windows应用商店的应用程序。我不明白,在这个位置上微软,他们吸。
EntityFramework isn't available for Windows Store Apps. I don't understand Microsoft position on this, they suck.
另一种解决方案是使用SQLite的,但它不是ORM。那么,有什么意义呢?
The other solution is to use SQLite but it's not ORM. So what's the point?
据我所知,Windows 8的存储应用目标的WinRT(Windows运行时)。
As far as I know, Windows 8 Store Apps target WinRT (Windows Runtime).
有关这个原因,因为WinRT的可以使用C#进行有针对性的,这儿有很多来自.NET框架具有WinRT的比赛类,最可用的代码库不使用非常具体的图书馆也可以工作在Windows 8商店应用程序。
For that reason, because WinRT can be targeted using C# and there're a lot of classes from .NET Framework having a match in WinRT, most of available code base not using very specific libraries may work also on Windows 8 Store Apps.
有是很多事情在WinRT中不可用。例如,实体框架是建立在ADO.NET之上,这是不是可以在WinRT的。
There're a lot of things unavailable in WinRT. For example, Entity Framework is built on top of ADO.NET and this isn't available on WinRT.
Visual Studio是的足够聪明的隐藏这些类和组件不可用在WinRT中,这就是为什么实体框架相关的类可以吨您的Windows 8 Store应用项目中使用。
Visual Studio is smart enough to hide such classes and components that aren't available on WinRT and this is why Entity Framework related classes can't be used in your Windows 8 Store App project.
为了使用实体框架,你需要创建一个基于REST的Web API(例如使用ASP.NET网页API),并通过导线异步访问数据层。
In order to use Entity Framework, you'll need to create a RESTful Web API (for example using ASP.NET Web API) and access the data layer asynchronously over the wire.
否则,您必须使用本地数据库存储像SQLite的或XML。
Otherwise, you'll need to use a local database storage like SQLite or XML.