private void ProcessRefreshRequest(RecordedEvent recordedEvent) { Logger.Trace("Processing Refresh request"); var payload = recordedEvent.Deserialize<RefreshContactsCommand>(); var accountContacts = GetOrCreateAccountContacts(payload); accountContacts.RequestRefresh(payload.UserId); }
private void AddAccount(RecordedEvent userCreatedEvent) { var payload = userCreatedEvent.Deserialize<UserCreatedEvent>(); var key = GetKey(payload.Account.Provider, payload.Account.AccountId); //TODO: What do I do if there are duplicates or it is missing? -LC var accountContacts = _accountContactsFactory.Create(payload.Account); _accounts.Add(key, accountContacts); }
private void UpdateContact(RecordedEvent originalEvent) { var payload = originalEvent.Deserialize<AccountContactBatchUpdateRecord>(); Logger.Trace("Updating {0} contact(s) for Account '{1}' on user '{2}'", payload.Contacts.Length, payload.AccountId, payload.UserId); var userContacts = GetUserContacts(payload); using (userContacts.TrackChanges()) { foreach (var contact in payload.Contacts) { userContacts.Add(contact); } SaveUpdates(userContacts); userContacts.CommitChanges(); } }
private void AddAccountToCache(RecordedEvent recordedEvent) { var userCreatedEvent = recordedEvent.Deserialize<UserRegisteredAccountEvent>(); var account = CreateAccount(userCreatedEvent.Account); var useridx = _userCache.FindIndex(u=>u.Id == userCreatedEvent.UserId); var cachedUser = _userCache[useridx]; var newUser = cachedUser.AddAccount(account); _userCache[useridx] = newUser; }
private void AddUserToCache(RecordedEvent recordedEvent) { var userCreatedEvent = recordedEvent.Deserialize<UserCreatedEvent>(); var account = CreateAccount(userCreatedEvent.Account); var accounts = new[] { account }; var user = new User(userCreatedEvent.Id, userCreatedEvent.DisplayName, accounts); _userCache.Add(user); }
private void AddUser(RecordedEvent userCreatedEvent) { var payload = userCreatedEvent.Deserialize<UserCreatedEvent>(); LinkUserIdToAccountId(payload.Id, payload.Account.AccountId); }
private void AddAccount(RecordedEvent accountRegisteredEvent) { var payload = accountRegisteredEvent.Deserialize<UserRegisteredAccountEvent>(); LinkUserIdToAccountId(payload.UserId, payload.Account.AccountId); }