private static StreamReader _sr; // Reads text back from CMD.exe private static IDocumentStore RamDocumentStore(bool injectData = true) { var documentStore = new DocumentStore { Url = "http://localhost:8080/" }; documentStore.Conventions.FindIdentityProperty = prop => prop.Name == "Id"; documentStore.Initialize(); if (injectData) { using (var documentSession = documentStore.OpenSession()) { // if we have no roles, system is not configured, so run system setup var roles = documentSession.Query <Role>().ToList(); if (roles.Count == 0) { var systemStateManager = new SystemStateManager(documentSession); var setupSystemDataCommandHander = new SetupSystemDataCommandHandler( documentStore, documentSession, systemStateManager ); setupSystemDataCommandHander.Handle(new SetupSystemDataCommand()); documentSession.SaveChanges(); } } } IndexCreation.CreateIndexes(typeof(All_Groups).Assembly, documentStore); return(documentStore); }
private static IDocumentStore RamDocumentStore(bool injectData = true) { var documentStore = new DocumentStore { Url = "http://localhost:8080/" }; documentStore.Conventions.FindIdentityProperty = prop => prop.Name == "Id"; documentStore.Initialize(); if (injectData) { using (var documentSession = documentStore.OpenSession()) { // if we have no roles, system is not configured, so run system setup var roles = documentSession.Query<Role>().ToList(); if (roles.Count == 0) { var systemStateManager = new SystemStateManager(documentSession); var setupSystemDataCommandHander = new SetupSystemDataCommandHandler( documentStore, documentSession, systemStateManager ); setupSystemDataCommandHander.Handle(new SetupSystemDataCommand()); documentSession.SaveChanges(); } } } IndexCreation.CreateIndexes(typeof(All_Groups).Assembly, documentStore); return documentStore; }