Using RavenDB, RavenHQ and CloudBird
RavenHQ and CloudBird are two solid RavenDB add-ons that gives RavenDB persistence support to your AppHarbor application.
To use RavenDB in a .NET application, start out by installing the RavenDB client from NuGet:
Install-Package RavenDB
Applications with the RavenHQ or CloudBird add-on provisioned on
AppHarbor can load the a connectionstring either out of the
appSettings element (it's called
RAVENHQ_CONNECTION_STRING
/CLOUDBIRD_CONNECTION_STRING
)
or from the connectionstrings element named RavenDB
.
We recommend adding a connectionstring named RavenDB
to your web.config. That value that will be overwritten with the
correct RavenHQ/CloudBird value when your application is deployed
on AppHarbor.
<connectionStrings>
<add name="RavenDB" connectionString="Url = http://localhost:8080"/>
</connectionStrings>
With that configured, you can initialize your DocumentStore like this:
Store = new EmbeddableDocumentStore
{
ConnectionStringName = "RavenDB",
};
Store.Initialize();
A valid connectionstring for running in you local machine could look like this:
<connectionStrings>
<add name="RavenDB" connectionString="DataDir=~\App_Data\Database" />
</connectionStrings>
We have created a complete sample app that demonstrates how you can use RavenDB in an ASP.NET MVC application. It uses embeddable RavenDB mode when you debug on your local machine and the hosted add-on once you deploy on AppHarbor. There are additional resources on the RavenDB web site.