IParcelVisionEvent IEventConverter.Convert(IParcelVisionEvent @event) { if (((IEventConverter)this).CanConvert(@event)) { return(Convert((TSource)@event)); } throw new ArgumentException(nameof(@event)); }
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); } }
bool IEventConverter.CanConvert(IParcelVisionEvent @event) { return(@event.GetType().IsAssignableFrom(SourceType)); }