Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows phone 8.1 Local Database [closed]

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 ?

Thanks in advance.

like image 367
MajkeloDev Avatar asked Oct 16 '14 18:10

MajkeloDev


2 Answers

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: 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.

  2. 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.

like image 51
Stephan Avatar answered Sep 30 '22 20:09

Stephan


SQLite for the database, SQLite-net for the ORM

All details are here http://developer.nokia.com/community/wiki/How_to_use_SQLite_in_Windows_Phone

like image 33
hugo Avatar answered Sep 30 '22 20:09

hugo