Exemplo n.º 1
0
        public QueryIntegrationTestBase()
        {
            var conf  = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();
            var rconf = RavenConfig.FromConfiguration(conf);

            DocumentStore = new RavenDocumentStoreFactory().CreateDocumentStore(rconf);
        }
Exemplo n.º 2
0
        public void CanConnectToServer()
        {
            var conf  = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();
            var rconf = RavenConfig.FromConfiguration(conf);
            var store = new RavenDocumentStoreFactory().CreateDocumentStore(rconf);

            using (var s = store.OpenSession()) { }
        }
Exemplo n.º 3
0
        public IDocumentStore CreateDocumentStore(RavenConfig conf)
        {
            var store = new DocumentStore {
                Urls = conf.Urls
            };

            if (!string.IsNullOrWhiteSpace(conf.CertificateFilePath))
            {
                store.Certificate = new X509Certificate2(conf.CertificateFilePath, conf.CertificateFilePassword);
            }
            store.Database = conf.DatabaseName;
            store.Initialize();
            IndexCreation.CreateIndexes(typeof(Organizations_Smart_Search).Assembly, store);
            return(store);
        }
Exemplo n.º 4
0
        static IHostBuilder CreateHostBuilder(string[] args)
        => Host.CreateDefaultBuilder()
        .ConfigureServices((hostContext, services) =>
        {
            var docStore = new RavenDocumentStoreFactory().CreateAndInitializeDocumentStore(RavenConfig.FromConfiguration(hostContext.Configuration));
            services.AddSingleton(docStore);
            services.AddSingleton <INoSqlStore, DefensiveRavenDbProjectionsStore>();
            services.AddSingleton <ISqlStore, DefensiveRavenDbProjectionsStore>();
            services.AddTransient <IQueryById, QueryById>();
            services.AddTransient <ICheckpointReader, RavenDbCheckpointReader>();
            services.AddTransient <ICheckpointWriter, RavenDbCheckpointWriter>();
            services.AddTransient <IHandlerFactory, DIHandlerFactory>();
            services.AddTransient <ISubscriptionFactory, ESSubscriptionFactory>();
            services.AddTransient <IProjectionsFactory, ProjectionsFactory>();
            services.AddTransient <IJSProjectionsFactory, JSProjectionsFactory>();

            RegisterProjectionHandlers(services);

            services.AddHostedService <ServiceInstance>();
        })
        .ConfigureHostConfiguration(configHost =>
        {
            configHost.SetBasePath(Directory.GetCurrentDirectory());
            configHost.AddJsonFile("appsettings.json", optional: false);
            configHost.AddEnvironmentVariables(prefix: "STARNET_");
            configHost.AddCommandLine(args);
        });
Exemplo n.º 5
0
 IDocumentStore CreateRavenDbDocumentStore()
 => new RavenDocumentStoreFactory().CreateAndInitializeDocumentStore(RavenConfig.FromConfiguration(Configuration));