public async Task Handle(ProjectCreatedEvent notification, CancellationToken cancellationToken) { var projectInfo = await _solutionProjectRepository.GetAsync(notification.ProjectId); var processEntity = new SolutionProcess() { SolutionId = projectInfo.SolutionId, Level = SolutionProcessLevel.Project, Content = $"创建项目【{projectInfo.Name}({projectInfo.CName})】", CreatedOn = DateTime.Now }; await _solutionProcessRepository.AddAsync(processEntity, cancellationToken); var changedRow = await _unitOfWork.SaveChangesAsync(cancellationToken); _logger.LogInformation($"触发ProjectCreatedEvent事件处理器 -> ProjectCreatedEventHandler_AddProcess -> ProjectId={notification.ProjectId} -> changedRow={changedRow}"); }
public async Task Handle(EnvCreatedEvent notification, CancellationToken cancellationToken) { var envInfo = await _solutionEnvRepository.GetAsync(notification.EnvId); var process = new SolutionProcess() { SolutionId = notification.SolutionId, Level = SolutionProcessLevel.Env, Content = $"创建环境变量【{envInfo.EnvName}】", CreatedOn = DateTime.Now }; await _solutionProcessRepository.AddAsync(process, cancellationToken); var changedRow = await _unitOfWork.SaveChangesAsync(cancellationToken); _logger.LogInformation($"触发EnvCreatedEvent事件处理器 -> EnvCreatedEventHandler_AddProcess -> EnvId={notification.EnvId} -> changedRow={changedRow}"); }