In my first post about this subject I’ve showed you how to start quickly with RavenDB and several ways of deployment.
One option was to run RavenDB in the application – the advantage is that you don’t need a separate server even the Web-Admin-UI is able to activate because of that the usage in the WebApp is not useful. I’ve heard about better opportunities (more about that later).
RavenDB as Embedded Version is also available as NuGet Package:
The code is almost the same like in the first post but in fact we only the Embedded Namespace including the DocumentStore:
private static IDocumentStore CreateDocumentStore() { var documentStore = new EmbeddableDocumentStore { ConnectionStringName = "RavenDB" }.Initialize(); return documentStore; }
In the web.config you will find this:
<connectionStrings> <add name="RavenDB" connectionString="DataDir = ~\App_Data" /> </connectionStrings>
Beware: If you use the usual DocumentStore you will receive this error message:
‘RavenDB could not be parsed, unknown option: datadir’ – so take care to check if it’s the right type from the Embedded Area.
The different types of the ConnectionStrings are described here. The result is that all Files are abandoned at App_Data without an additional service needs to run.