Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local Database for Silverlight, MonoTouch, MonoDroid, and Windows Phone

I'm looking for a local database that will work with Silverlight, Windows Phone, MonoDroid, and MonoTouch.

My application is probably going to treat the database as read-only, but I don't want to have to re-encode the data for each platform. (I am also this close '...' to just using XML.)

like image 731
Jonathan Allen Avatar asked Jan 21 '12 08:01

Jonathan Allen


1 Answers

I used the Mono.Data.Sqlite libraries for the Mono for Android and MonoTouch versions of my app and use the C# SQLite / Community.CsharpSqlite.SQLiteClient libraries on the Windows Phone.

Not all the features are implemented with this version, but most are and it is useable.

I used a slightly modified version of the sqlite-net library for a really basic ORM. sqlite-net uses P/Invoke which is not allowed on the Windows Phone, so I removed these and replaced it with the classes (eg: SqliteCommand) from the other libraries.

What is also nice is that they have the same method signatures so all I have to do is:

#if WINDOWS_PHONE
    using Community.CsharpSqlite.SQLiteClient;
#else
    using Mono.Data.Sqlite;
#endif
like image 162
Matthew Avatar answered Sep 28 '22 02:09

Matthew