Friday, March 9, 2012

SQLite.NET

SQLite.NET is an ORM that works under MONO. If you are asking yourself what any of those terms are then you should probably stop reading now. ;-)

So when I started working on my current iPad project I went looking or an ORM. The idea of focusing effort on SQL based inserts, updates, etc makes me shudder. In any event being on the iPad the availability of these libraries is fairly limited. SQLite.NET fit the bill, but I soon ran into some glaring omissions that I've only now, a year later gotten around to fixing.

Things that no ORM should be without:
The ability to specify the table for a class.
The idea that a class should have a table named directly after the class assumes that your business logic, and your database logic are one-for-one is fundamentally flawed. Additionally the ability to create multiple models for one set of data is important as well. One model, which is cut down for displaying a list of items, one that is fully fleshed out for retrieval of an entity.

The ability to store and retrieve GUIDs
I tend to use GUID's for ID's for logic. It's convenient and ensures that ID's are unique no matter where they are generated. It was a fairly simple task to encode a GUID, which SQLite doens't support as a string, and then pull the data back in.

That was the two improvements I have made to date. More will come as I work on some more updates.

1 comment: