Using SqlLite in Windows Phone 8

Even thought SqlLite is still not very well supported on WP8 compared with SQL CE, it can be convenient to use it expecially if you want to share some DAL code with an other platform like Android or even Windows 8 app. The portability and its semplicity are the main features of SqlLite DB.

First of all you have to choose a convenient program to handle on your PC the data file created by SqlLite. I find SQLiteStudio the more convenient and easy to configure (there is no installer, since all you need to run SQLiteStudio is to download the binary distribution from download page and just run) but in the following you can find some other valid alternatives:

sql workbench - JDBC driver configuration

sql workbench – JDBC driver configuration

To properly configure the solution for Handling a SqlLite DB, There are several blogs that explain it in a very similar way, for example:

What you need is to install SQLite for Windows Phone that install in C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80\ … a C++ library (sqlite3.dll) that need to have a wrapper to be used in a C# project. So you need to add to your solution a wrapper project and make e refenence to it in your DAL project. There are two possible wrappers available:

  1. sqlite-net-wp8 project (github.com)
  2. sqlite-winrt project (codeplex.com)

The first wrapper library is very simple to use, but it has some limitations: the biggest one is that doesn’t support relationships out of the box.

The second wrapper doesn’t support any LINQ operation but only manual SQL statement: the biggest pro is that you can perform any type of operation, even managing relationships. The biggest cons is that you’ll have to rely on old plain SQL queries to do any operation, even the simplest ones, like creating a table or inserting some data.

For more information to make the right choice for you, se the following posts:

To see the documentation of sqlite-net (very few), go to that wiki.

For a tutorial and a reference on SqlLite you can go here. (* ); remember to put  on the Build tab, Conditional compilation symbols under the General header, SILVERLIGHT;WINDOWS_PHONE;USE_WP8_NATIVE_SQLITE

To handle the GIT repository of sqlite-net and sqlite-net-wp8, you can use Visual Studio Tools for Git or better GitHub

In the following  there are some links where you can find slides and examples how to use SqlLite in WP8:

That’s all for now … I’ll put some code example in the next days … stay tuned 😉

Annunci

Informazioni su Enzo Contini

Electronic engineer
Questa voce è stata pubblicata in SqLite, Windows Phone/Mobile. Contrassegna il permalink.

Lascia un Commento/Leave a comment

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...