Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        public static NotificationPipeline Create(NotificationPipelineName name, NotificationPipelineDescription description,
                                                  String triggerTypeIdentifier, NotificationCondition conndition, NotificationActor actor,
                                                  ILogger <NotificationPipeline> logger, INotificationConditionFactory conditionFactory, INotificationActorFactory actorFactory)
        {
            if (conndition == null)
            {
                conndition = NotificationCondition.True;
            }
            Guid id = Guid.NewGuid();

            var pipeline = new NotificationPipeline(id, conditionFactory, actorFactory, logger);

            pipeline.Apply(new NotificationPipelineCreatedEvent
            {
                Id                  = id,
                Name                = name,
                Description         = description,
                TriggerIdentifier   = triggerTypeIdentifier,
                ConditionCreateInfo = conndition.ToCreateModel(),
                ActorCreateInfo     = actor.ToCreateModel(),
            });

            return(pipeline);
        }