Ejemplo n.º 1
0
        private IDocumentStore CreateDocumentStore(IApplicationHost applicationHost,IConfigurationProvider configurationProvider)
        {
            var useRemoteDatabase = configurationProvider.GetValue("Database/UseRemote", false);

            if ( useRemoteDatabase )
            {
                return new DocumentStore() {ConnectionStringName = "Default"};
            }
            else
            {
                var dataPath = applicationHost.MapPath(configurationProvider.GetValue("Database/LocalPath", "~/App_Data"));
                if ( !Directory.Exists(dataPath))
                {
                    Directory.CreateDirectory(dataPath);
                }

                return new EmbeddableDocumentStore() { DataDirectory = dataPath};
            }
        }