Exemplo n.º 1
0
        public static void ConfigureApp(RegistrationApp app, string eventNamespace, string eventAssembly)
        {
            var settings = ConnectionSettings.Create()
                           .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"))
                           .KeepReconnecting()
                           .KeepRetrying()
                           //.UseConsoleLogger()
                           .Build();
            var conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113));

            conn.ConnectAsync().Wait();


            var repo = new SimpleRepo(conn, eventNamespace, eventAssembly);

            var userRm = new RegisteredUsers(() => conn, repo.Deserialize);

            var mainBus = new SimpleBus();

            var userSvc = new UserSvc(repo);

            mainBus.Subscribe <RegisterUser>(userSvc);
            mainBus.Subscribe <ChangeName>(userSvc);

            //application wire up
            //app.CommandPublisher = mainBus;
            //userRm.Subscribe(app.DisplayUsers);
            //start
            userRm.Start();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Bootstrap
            var settings = ConnectionSettings.Create()
                           .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"))
                           .KeepReconnecting()
                           .KeepRetrying()
                           //.UseConsoleLogger()
                           .Build();
            var conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113));

            conn.ConnectAsync().Wait();

            var eventNamespace = "Administration.EventModel.Events";
            var eventAssembly  = "Administration";

            var repo = new SimpleRepo(conn, eventNamespace, eventAssembly);

            var roomTypeRm = new RoomTypeReader(() => conn, repo.Deserialize);

            var mainBus = new SimpleBus();

            var adminSvc = new AdminSvc(repo);

            mainBus.Subscribe <AddRoomType>(adminSvc);
            mainBus.Subscribe <AddRoom>(adminSvc);

            var view       = new ConsoleView();
            var controller = new Controller(view, mainBus);

            roomTypeRm.Subscribe(model => view.RoomSummaries = model);

            view.Redraw();
            roomTypeRm.Start();
            controller.StartCommandLoop();

            Console.WriteLine("press enter to exit");
            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            //Bootstrap
            var settings = ConnectionSettings.Create()
                           .SetDefaultUserCredentials(new UserCredentials("admin", "changeit"))
                           .KeepReconnecting()
                           .KeepRetrying()
                           //.UseConsoleLogger()
                           .Build();
            var conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113));

            conn.ConnectAsync().Wait();

            var eventNamespace = "Registration.Blueprint.Events";
            var eventAssembly  = "Registration";

            var repo = new SimpleRepo(conn, eventNamespace, eventAssembly);

            var roomRm = new RoomsReader(() => conn, repo.Deserialize);

            var mainBus = new SimpleBus();

            var roomSvc = new RoomSvc(repo);

            mainBus.Subscribe <AddRoom>(roomSvc);

            var view       = new ConsoleView();
            var controller = new Controller(view, mainBus);

            var database = new DataBase();

            var eventDispatch = new EventDispatcher(database);

            var app = new RegistrationApp();

            app.GenerateData(eventDispatch);

            // roomRm.Subscribe( model => view.HistorySummaries = model);

            roomRm.Start();

            controller.StartCommandLoop();

            Console.WriteLine("press enter to exit");
            Console.ReadLine();
        }