## Saturday, November 20, 2010

### Running RavenDb embedded

I seem to have some trouble finding how to run RavenDb in embedded mode. This isn’t the same as my post on running RavenDb embedded for .NET 3.5. This time, I’ve already updated to .NET 4, so I should be able to use the RavenDb embedded assemblies. I’m using build 193 by the way.

The documentation on RavenDb.net is a little out of date, but that’s normal, because RavenDb is still very actively under development. A downside of using a new technology.

But here goes. Start by referencing Raven.Client.Embedded. Instead of using a DocumentStore, you should now use an EmbeddablDocumentStore (in my version of RavenDb there’s still a typo, it should be Embeddable I believe):

var store = new EmbeddablDocumentStore { DataDirectory = @"D:\path\to\documentstore" };store.Initialize();

You will also need a reference to Raven.Client.Lightweight, Raven.Storage.Essent (to avoid the “Could not find transactional storage type: Raven.Storage.Esent.TransactionalStorage, Raven.Storage.Esent” exception at runtime) and System.ComponentModel.Composition.

Note: At one time I got the exception: “Could not open transactional storage: D:\RavenDbTest\Data”. This was because somewhere else in my code, I was initializing the store again, when it was already initialized.

#### 1 comment:

m.bagattini said...

For the sake of completeness: if you have a project (say, Windows Forms application) which reference a library referencing all RavenDB stuff, you still have to reference RavenDB dlls also in your main project, otherwise you'll get that "Could not find transactional storage" exception.