public MyApp()
{
var documentStore = new DocumentStore
{
Url = "http://server"
};
documentStore.RegisterListener(new ContextualDocumentStoreListener<UserNameContext>());
// can be called after .Initialize(), doesn't matter
documentStore.Initialize();
using (new UserNameContext("Damian Hickey"))
using (IDocumentSession session = documentStore.OpenSession())
{
session.Store(new Doc());
session.SaveChanges();
}
}
}