Esempio n. 1
0
 /// <summary>
 /// Create a service to act on User aggregates.
 /// </summary>
 /// <param name="repo">The repository for interacting with the EventStore.</param>
 /// <param name="bus">The dispatcher.</param>
 public UserSvc(IRepository repo, IDispatcher bus) : base(bus)
 {
     _repo = new CorrelatedStreamStoreRepository(repo);
     Subscribe <UserMsgs.CreateUser>(this);
     Subscribe <UserMsgs.Deactivate>(this);
     Subscribe <UserMsgs.Activate>(this);
     Subscribe <UserMsgs.UpdateUserDetails>(this);
     Subscribe <UserMsgs.MapToAuthDomain>(this);
     Subscribe <UserMsgs.AddClientScope>(this);
     Subscribe <UserMsgs.RemoveClientScope>(this);
 }
        public when_using_correlated_repository()
        {
            var mockStore = new MockStreamStoreConnection("testRepo");

            mockStore.Connect();
            var repo = new StreamStoreRepository(new PrefixedCamelCaseStreamNameBuilder(), mockStore, new JsonMessageSerializer());

            _correlatedRepo = new CorrelatedStreamStoreRepository(repo);
            ICorrelatedMessage source = MessageBuilder.New(() => new CreateAccount(_accountId));
            var account = new Account(_accountId, source);

            account.Credit(7);
            account.Credit(13);
            account.Credit(31);
            repo.Save(account);
        }