Tests.Raven.Client.ContextualListeners.Sample.MyApp.MyApp C# (CSharp) Method

MyApp() public method

public MyApp ( ) : Raven.Client
return Raven.Client
            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();
                }
            }
        }
Sample.MyApp