Exemplo n.º 1
0
 public EventActivitySetBuilder <TEvent, TData> SetState(SetStateFunc <TEvent, TData> func, EventPredicate <TEvent, TData> predicate = null)
 {
     _eventActivitySet.AddSetStateHandler((whenEvent, data) =>
     {
         if (predicate != null && !predicate(whenEvent, data))
         {
             return(data.Data);
         }
         return(func(whenEvent, data));
     });
     return(this);
 }
Exemplo n.º 2
0
        public void AddSetStateHandler(SetStateFunc <TEvent, TData> func)
        {
            SetStateFunc = (@event, data) =>
            {
                var newData = data.Data;
                if (_starterPredicate == null || _starterPredicate((TEvent)@event, data))
                {
                    newData = func((TEvent)@event, data);
                }

                return(newData);
            };
        }