Created
September 18, 2012 21:33
-
-
Save jrusbatch/3746069 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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