Пример #1
0
        IParcelVisionEvent IEventConverter.Convert(IParcelVisionEvent @event)
        {
            if (((IEventConverter)this).CanConvert(@event))
            {
                return(Convert((TSource)@event));
            }

            throw new ArgumentException(nameof(@event));
        }
Пример #2
0
 public void StoreEvent(IParcelVisionEvent @event)
 {
     if (@event is AggregateUpdated)
     {
         ApplyEvent(@event);
     }
     else
     {
         throw new Exception($"Sorry only {nameof(AggregateUpdated)} events are currently supported");
     }
 }
        public IEnumerable <IParcelVisionEvent> UpconvertEvent(IParcelVisionEvent originalEvent)
        {
            ConvertFunction converterFunction;

            if (converters.TryGetValue(originalEvent.GetType(), out converterFunction))
            {
                foreach (var convertedEvent in converterFunction(originalEvent))
                {
                    yield return(convertedEvent);
                }
            }
            else
            {
                yield return(originalEvent);
            }
        }
Пример #4
0
 bool IEventConverter.CanConvert(IParcelVisionEvent @event)
 {
     return(@event.GetType().IsAssignableFrom(SourceType));
 }