Windows Phone的8.1本地数据库

问题描述:

我刚刚开始的advanture随着Windows Phone。我想写一些应用程序,但我需要像本地数据库。我应该使用什么样的?我无法找到任何解决方案。我试图本地数据库,但它不是可以在WP 8.1,我还发现了一个关于JSON的教程,但本教程也是过时的,它不是用8.1工作。我只想写基于与一个表数据库中的一点微小的应用程序,我可以读取和写入。请你给我一个链接到文章,其中该怎么解决我的问题?

i've just started an 'advanture' with windows phone. I want to write some app but i need something like Local DataBase. What should i use ? i can't find any solution. I tried local database but it's not available on WP 8.1, i also found a tutorial about working with json but this tutorial was also out of date and it's not working with 8.1. I just want to write a little tiny app based on DataBase with one table which i can read from and write into. Could You please send me a link to article which gonna solve my problem ?

先谢谢了。

我猜你是在谈论的Windows Phone 8.1的通用,对不对?本地数据库只支持WP7,WP8和WP8.1的Silverlight(但没有通用的!)。两个备选方案来我的心。

I guess you are talking about Windows Phone Universal 8.1, right? Local database is only supported on WP7, WP8 and WP8.1 Silverlight (but no universal!). Two alternatives come to my mind.


  1. SQLite的:这是一种对于许多移动应用程序的标准,也可用于Windows Phone的8.1通用。你可以在这里找到上一个很好的教程(以防万一你指的是WP8.1 Silverlight的话可以找我的教程之一,在这里一>)。但是,在Windows Phone的设置SQLite是一种棘手的,因为你需要确保包括正确的NuGet包。 SQLite是非托管代码。你的意思是会松动是编译的值为anycpu。对于模拟器,你必须使用X86,将您的应用部署到你需要建立面向ARM设备/市场。我在我现有的应用程序正在从本地数据库SQLite和我花了约5漫长的夜晚得到它运行

  1. SQLite: This is kind of the standard for many mobile apps and is also available for Windows Phone 8.1 Universal. You can find a good tutorial on that here (just in case you are referring to WP8.1 Silverlight then you can find one of my tutorials here). However, setting up SQLite in Windows Phone is kind of tricky as you need to make sure to include the right nuget packages. SQLite is non-managed code. What'll you'll loose is compile as AnyCPU. For the emulator you have to use x86, to deploy your app to the device/marketplace you need to build for ARM. I was moving in my existing app from local database to SQLite and it took me ~5 long evenings to get it running.

iBoxDB:因为我不一定需要一个关系数据库SQLite的像我尝试了iBoxDB,你可以在这里找到 。我只花了3个小时包括它在我的项目,因为它只是一个包装的NuGet,很容易成立。这里的缺点是,它们的文档可能会更好。他们有一个庞大的样本文件中包含这有助于了解它是如何工作以及你可以找到他们的网站上的信息。到目前为止,这种效果非常好,因为它是完全托管的代码,我可以重新编译使用值为anycpu。但正如我所说,这取决于你是否真的需要有桌子和这样或是否是确定你刚刚保存的对象某处的关系数据库。顺便说一句。它也包含索引因此性能没有问题。

iBoxDB: As I don't necessarily need a relational database like SQLite I tried out iBoxDB which you can find here. It took me just 3 hours to include it in my project as it is just one nuget package and very easy to set up. The downside here is that their documentation could be better. They have a huge sample file included which helps to understand how it works plus the info that you can find on their website. So far, this really works well and I can compile using AnyCPU again as it is completely managed code. But as I said, it depends on whether you really need a relational database with tables and such or whether it is ok for you to just save the objects somewhere. Btw. it also contains indexes so performance is no issue.