public async Task <Guid?> Handle(CreateNotificationPipelineCommand request, CancellationToken cancellationToken) { _logger.LogDebug("Handle started"); var pipeline = NotificationPipeline.Create( NotificationPipelineName.FromString(request.Name), String.IsNullOrEmpty(request.Description) == true ? NotificationPipelineDescription.Empty : NotificationPipelineDescription.FromString(request.Description), request.TriggerName, _conditionFactory.Initilize(new NotificationConditionCreateModel { Typename = request.CondtionName, PropertiesAndValues = request.ConditionProperties, }), _actorFactory.Initilize(new NotificationActorCreateModel { Typename = request.ActorName, PropertiesAndValues = request.ActorProperties, }), _loggerFactory.CreateLogger <NotificationPipeline>(), _conditionFactory, _actorFactory ); Boolean storeResult = await _engine.AddNotificationPipeline(pipeline); if (storeResult == false) { return(null); } return(pipeline.Id); }
protected override void When(DomainEvent domainEvent) { switch (domainEvent) { case NotificationPipelineCreatedEvent e: Name = new NotificationPipelineName(e.Name); Description = new NotificationPipelineDescription(e.Description); Id = e.Id; TriggerIdentifier = e.TriggerIdentifier; Condition = _conditionFactory.Initilize(e.ConditionCreateInfo); Actor = _actorFactory.Initilize(e.ActorCreateInfo); break; default: break; } }