see on GitHub

How to Create a Document Store

To create an instance of the DocumentStore you need to specify a list of URL addresses that point to RavenDB server nodes.


Do not open a DocumentStore using URL addresses that point to nodes outside your cluster.

using (IDocumentStore store = new DocumentStore()
    Urls = new[] {"http://localhost:8080"}


This will instantiate a communication channel between your application and the local RavenDB server instance.


To be able to work on the DocumentStore, you will have to call the Initialize method to get the fully initialized instance of IDocumentStore.


Because the document store is a heavyweight object, there should only be one instance created per application (singleton). The document store is a thread safe object and its typical initialization looks like the following:

public class DocumentStoreHolder
	private static Lazy<IDocumentStore> store = new Lazy<IDocumentStore>(CreateStore);

	public static IDocumentStore Store => store.Value;

    private static IDocumentStore CreateStore()
		IDocumentStore store = new DocumentStore()
		    Urls = new[] { "http://localhost:8080" },
                  Database = "Northwind"

		return store;


If you use more than one instance of DocumentStore you should dispose it after use.