Karvonite as alternative to RavenDB in a desktop application

Right now, I’m using RavenDB, but it seems to be a little overkill. It’s a great piece of software, very powerful, but a little too powerful for what I need. It handles all sorts of fancy stuff like sharding, replication, versioning, etc. I have the impression it’s made for applications that have fairly hefty requirements, often client/server applications that need to scale up in time.

Also, specifically for me, the licensing of RavenDB is too expensive. I don’t have a clear view of where my application is going. Will I be able to sell it to customers? Will I open source it? Will I build it to a certain point and then sell it?

So, I started looking for an alternative to RavenDB, keeping in mind that I’m developing a classic desktop application. I considered MongoDB, but it is also aimed at scalable applications with a server (I believe). I looked at Sterling, which is aimed at Silverlight and Windows Phone. Someone ported it to the desktop, but I’d have to rebuild it with every update.

But recently, I found Karvonite. It promises to give you persistence ignorance, and can serialize objects, even with circular and shared references. It also supports a changing domain model. It supports Windows, XNA (XBOX), and Windows Phone.

Setting it up was fairly easy:

  1. Reference Karvonite40.dll in the correct directory (based on your platform).
  2. Use the Persistence Model Editor to generate a Persistence Model.
  3. Add the generated kvtmodel file as Embedded Resource.
  4. I made an ObjectSpaceFactory to initialize the ObjectSpace if necessary, and return it (only open the ObjectSpace once).
  5. Wired it up to my BaseRepository

Presto!

I’m amazed I never heard of this, and hope it will continue to be under development. I’ll post more details when I learn more about it, but for now, initial tests work.

Oh, recommended reading: the Karvonite overview.