Example #1
0
            public DocumentStatisticsModule(IDocumentStore ravenDatabase, Dispatcher eventDispatcher)
            {
                this.ravenDatabase = ravenDatabase;

                projector = new CountsProjector(eventDispatcher, ravenDatabase.OpenAsyncSession);

                new Documents_ByDynamicState().Execute(ravenDatabase);
                new Documents_CountsByStaticState().Execute(ravenDatabase);
            }
Example #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            var eventStore       = new JsonFileEventStore("ExampleEvents.zip", 100);
            var projectionsStore = new InMemoryDatabase();

            var dispatcher   = new Dispatcher(eventStore.Subscribe);
            var stats        = new ProjectionStats(() => System.DateTime.UtcNow);
            var bootstrapper = new CountsProjector(dispatcher, projectionsStore, stats);

            services
            .AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddSingleton <InMemoryDatabase>(projectionsStore);
            services.AddSingleton <ProjectionStats>(stats);

            bootstrapper.Start();
        }