Esempio n. 1
0
        public static void Main(string[] args)
        {
            var container = TinyIoCContainer.Current;

            var eventStore = new JsonFileEventStore("ExampleEvents.zip", 100);

            EmbeddableDocumentStore store = BuildDocumentStore(".\\", 9001);

            container.Register <Func <IAsyncDocumentSession> >(() => store.OpenAsyncSession());
            var dispatcher = new Dispatcher(eventStore);

            var bootstrapper = new CountsProjector(dispatcher, store.OpenAsyncSession);

            var startOptions = new StartOptions($"http://localhost:9000");

            using (WebApp.Start(startOptions, builder => builder.UseControllers(container)))
            {
                bootstrapper.Start().Wait();

                Console.WriteLine($"HTTP endpoint available at http://localhost:9000/api/Statistics/CountsPerState");
                Console.WriteLine($"Management Studio available at http://localhost:9001");

                Console.ReadLine();
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var container = TinyIoCContainer.Current;

            var eventStore = new JsonFileEventStore("ExampleEvents.zip", 100);

            var projectionsStore = new InMemoryDatabase();

            container.Register(projectionsStore);

            var dispatcher = new Dispatcher(eventStore.Subscribe);

            var bootstrapper = new CountsProjector(dispatcher, projectionsStore);

            var startOptions = new StartOptions($"http://localhost:9000");

            using (WebApp.Start(startOptions, builder => builder.UseControllers(container)))
            {
                bootstrapper.Start();

                Console.WriteLine($"HTTP endpoint available at http://localhost:9000/api/Statistics/CountsPerState");

                Console.ReadLine();
            }
        }
        public static void Main(string[] args)
        {
            var eventStore = new JsonFileEventStore("ExampleEvents.zip", 100);

            var store = new InMemorySqLiteDatabaseBuilder().Build();

            var dispatcher = new Dispatcher(eventStore.Subscribe);

            var projector = new CountsProjector(dispatcher, store.SessionFactory.OpenSession);

            var startOptions = new StartOptions($"http://localhost:9000");

            using (WebApp.Start(startOptions, builder => builder.UseStatisticsApi(() => store.SessionFactory.OpenSession())))
            {
                projector.Start();

                Console.WriteLine($"HTTP endpoint available at http://localhost:9000/api/Statistics/CountsPerState");
                Console.ReadLine();
            }
        }