コード例 #1
0
        private void HandleUserUpdatedEvent(UserUpdatedEvent e)
        {
            UserState    cs = e.ResultUserState;
            UserListItem newUserListItem = UserListItem.GenerateUserListItemFromUserState(cs);

            UserListUpdateCommand newCLUC = new UserListUpdateCommand(newUserListItem, e.User, e.ConnectionId);

            _logger.Info($"Updating User list Id:{cs.Id} UserName:{cs.UserName}.");
            Persist <UserListUpdateCommand>(newCLUC, postUserListItemUpdateHandler);
        }
コード例 #2
0
        /// <summary>
        /// This method handles User insert events by updating the Admin's User list to the latest information.
        /// </summary>
        /// <param name="e">UserInserted event.</param>
        private void HandleUserInsertedEvent(UserInsertedEvent e)
        {
            if (_ActorState[e.Id] == null)
            {
                UserState    cs = e.ResultUserState;
                UserListItem newUserListItem = UserListItem.GenerateUserListItemFromUserState(cs);

                // It does not matter if the item exists or not we will stomp for that particular User the existing data
                // with the new data - see post insert handler.
                // Persist the event that a new User was added to the User list
                UserListInsertCommand newCLIC = new UserListInsertCommand(newUserListItem, e.User, e.ConnectionId);
                _logger.Info($"Inserting new User list item Id:{cs.Id} UserName:{cs.UserName}.");
                Persist <UserListInsertCommand>(newCLIC, postUserListItemInsertHandler);
            }
        }