Archive for the ‘ORM’ Category

I have recently started using this simple & elegant ORM called CoolStorage, written by the people from The Vici Project.

What makes CoolStorage great is that it’s been tweaked for MonoTouch and SQLite. All you need to do to start using it is,

download the assemblies that have been build for Mono on the Mac

reference them in you MonoTouch projects

add a few lines of startup/connection code

Once you’ve pointed CoolStorage at your SQLite database, the last piece of the puzzle is (well you may have guessed, as this is an ORM) to create some C# classes that map to you table structure. What I love is the lack of attribute annotation that you need, here is an example,

Anyway you get the idea. There is much more to learn so make sure you head over to their website!

Last thing to mention. The Novell team have been working feverishly on getting Mono on the Android platform; I’m sure you’ve heard by now about MonoDroid. Well I’ve by messing around with it in its Beta form on Windows/Visual Studio 2010. Since SQLite is the database of choice for this platform, I figured that I would try to get CoolStorage work there too.

It’s not too difficult as it turns out, here are the steps,

I created two MonoDroid library projects in VS 2010, one for vici.core.dll & one for vici.coolstorage.dll

Downloaded the code for vici.core & vici.coolstorage, see The Vici Project website

Now you can include these MonoDroid assembly versions of CoolStorage into your MonoDroid apps.

There is only one Gotcha! Took me a while to figure it out, but you need to make sure that your MonoDroid app is targeting 2.2 of the Android OS. It seems that previous versions of SQLite on Android didn’t support many of the needed functionality.