Esempio n. 1
0
        public AccountService()
        {
            IEventStoreConnection esConnection = EventStoreConnection.Create("ConnectTo=tcp://admin:changeit@localhost:1113");
            var conn = new EventStoreConnectionWrapper(esConnection);

            esConnection.Connected += (_, __) => { };
            //Console.WriteLine("Connected");
            esConnection.ConnectAsync().Wait();
            IStreamNameBuilder namer = new PrefixedCamelCaseStreamNameBuilder();
            IEventSerializer   ser   = new JsonMessageSerializer();

            _repo       = new StreamStoreRepository(namer, conn, ser);
            _cmdHandler = new AccountCommandHandler(_repo);

            var listener = new StreamListener("AccountAggregate", conn, namer, ser);

            _readModel = new BalanceReadModel(() => listener);
        }
Esempio n. 2
0
        protected AccountTestsBase()
        {
            AccountId = Guid.NewGuid();
            IEventStoreConnection esConnection = EventStoreConnection.Create("ConnectTo=tcp://admin:changeit@localhost:1113");
            var conn = new EventStoreConnectionWrapper(esConnection);

            esConnection.Connected += (_, __) => { };
            esConnection.ConnectAsync().Wait();
            IStreamNameBuilder namer = new PrefixedCamelCaseStreamNameBuilder("Tests");
            IEventSerializer   ser   = new JsonMessageSerializer();

            Repo       = new StreamStoreRepository(namer, conn, ser);
            CmdHandler = new AccountCommandHandler(Repo);

            var listener = new StreamListener("AccountAggregate", conn, namer, ser);

            ReadModel = new BalanceReadModel(() => listener);
        }