コード例 #1
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, IPEndPoint.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);

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

            roomRm.Start();

            controller.StartCommandLoop();

            Console.WriteLine("press enter to exit");
            Console.ReadLine();
        }
コード例 #2
0
 public Controller(ConsoleView view, IBus mainBus)
 {
     _view    = view;
     _mainBus = mainBus;
 }