I have blogged previously about my disdain for relational databases, and recently I’ve been looking harder and harder at ESENT.  In my two previous posts on the ESENT, I covered how you could use ESENT from .NET as well as why you might want to.  Because of the ugliness of the API, today you are probably better off using a different data store than ESENT.

Tomorrow may be a different story though (not THE tomorrow, I mean just some “tomorrow” in the future).  I just opened the Esenterate project on Google Code.  The purpose of Esenterate is to provide a clean, .NET-friendly API around ESENT that allows developers to focus on their application instead of persistence.  Eventually I plan for the API to support all major ESENT functionality, but the first release will target simple key/value storage.  No code has been committed yet, but I am working on designing the API.  I’ll post more snippets as I make progress and need feedback, but here’s one to get you started:

EsenterateFactory.AddClass<Widget>(w => w.ID,
    indexes =>
    {
        indexes.AddIndex(w => w.Name);
        indexes.AddIndex(w => w.Count);
    }
).CreateAt(@"path\to\esent");

The above snippet is used to create a new repository (you won’t have to call this code each time, only once to create the initial repository structure).  It simply says “Hey, make a repository that can store widgets, Widget.ID is the primary key, and I want to add indexes to Widget.Name and Widget.Count so that I can query across those columns quickly.” 

If you have any suggestions, please feel free to leave them here in the comments or on the project site at Google Code.