Skip to content

Instantly share code, notes, and snippets.

@jrusbatch
Created September 18, 2012 21:33
Show Gist options
  • Save jrusbatch/3746069 to your computer and use it in GitHub Desktop.
Save jrusbatch/3746069 to your computer and use it in GitHub Desktop.
public class DocumentSessionFactory : IDisposable
{
private readonly IDocumentStore documentStore;
public DocumentSessionFactory()
{
documentStore = new EmbeddableDocumentStore { RunInMemory = true };
documentStore.Initialize();
}
public IAsyncDocumentSession CreateSession()
{
var db = string.Format("db-{0:N}", Guid.NewGuid());
// Throws `NullReferenceException` w/ v1.2.2085-unstable from nuget.
return documentStore.OpenAsyncSession(db);
}
public void Dispose()
{
if (documentStore != null)
{
documentStore.Dispose();
}
}
}
@dotnetchris
Copy link

FWIW RunInUnreliableYetFastModeThatIsNotSuitableForProduction https://groups.google.com/forum/?fromgroups=#!topic/ravendb/vkiqoiZ6Fsc doesn't seem like it matters at all. RunIN... is for Esent and RunInMemory = Munin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment