예제 #1
0
        public void Delete(Guid userID)
        {
            var e = new UserDeletedEvent(Guid.NewGuid(), Guid.Empty, Version+1, DateTime.UtcNow)
            {
                UserID = userID,
                TimeStamp = DateTime.UtcNow
            };

            ApplyEvent(e);
        }
예제 #2
0
        public Task ExecuteAsync(HookType type, IDomainEntityContext <User> context, CancellationToken cancellationToken)
        {
            switch (context.EditMode)
            {
            case EditMode.Create:
                context.AddEventAsync(UserCreatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);
                break;

            case EditMode.Update:
                context.AddEventAsync(UserUpdatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);
                break;

            case EditMode.Delete:
                context.AddEventAsync(UserDeletedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken);
                break;
            }
            return(Task.CompletedTask);
        }
예제 #3
0
        public bool TranslateAkkaDeleteEventToExternalMessage(CommandEventMessage internalCommandEvent)
        {
            UserDeletedEvent e = internalCommandEvent as UserDeletedEvent;

            HTTPExternalInterface.HandleEDStateMessage(
                new HTTPDestinedCommandStateEvent(
                    MicroServices.ProcessingStatus.Processed,
                    e.Message,
                    new HTTPSourcedCommand(
                        e.CommandType.ToString(),
                        e.Area.ToString(),
                        null,
                        e.ResultUserState,
                        e.User,
                        e.ConnectionId,
                        e.Id
                        )
                    ),
                false //User only?
                );
            return(true);
        }
예제 #4
0
        /// <summary>
        /// Removes User(item) from the list.  If an instance of the UserActor is in memory it unloads it.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private void HandleUserDeletedEvent(UserDeletedEvent e)
        {
            // Is the item still in the list?
            if (_ActorState[e.Id] == null)
            {
                _logger.Info($"{e.User} tried deleting from User list id:{e.Id} but was not found.");
            }
            else
            {
                UserListItem cliNewState = _ActorState[e.Id].Copy();
                cliNewState.IsActive = false;

                // Memorialize that we are removing the item from the list in the journal
                UserListDeleteCommand UserListDeleteCommand = new UserListDeleteCommand(
                    cliNewState,
                    e.User,
                    e.ConnectionId);

                _logger.Info($"Deleting User list item Id{e.Id} UserName:{e.ResultUserState.UserName}.");
                Persist <UserListDeleteCommand>(UserListDeleteCommand, PostUserListDeleteHandler);
            }
        }
예제 #5
0
        public async Task HandleAsync(UserDeletedEvent domainEvent)
        {
            var user = await _userRepository.GetByIdAsync(domainEvent.AggregateId);

            await _userRepository.DeleteAsync(user);
        }
예제 #6
0
 public async Task HandleAsync(UserDeletedEvent args)
 {
     await SendNotificationAsync <Guid?, User, UserDto>(args, args.User, args.User.FullName);
 }
예제 #7
0
 protected void OnUserDeleted(UserDeletedEvent e)
 {
     _userState = UserState.Deleted;
 }