public void Handle(IEventSourcingEvent e) { switch (e.DomainEvent) { case Opened opened: Handle(opened); break; case GuessMade guessMade: Handle(guessMade); break; case LevelSucceeded succeeded: Handle(succeeded); break; case LevelFailed failed: Handle(failed); break; case GameCompleted completed: Handle(completed); break; } }
public void Handle(IEventSourcingEvent e) { string aggregateId = e.AggregateId; Handle(aggregateId, e); }
private void Handle(string aggregateId, IEventSourcingEvent @event) { string serializedEvent = JsonSerializer.Serialize(@event, typeof(IEventSourcingEvent)); _hub.Clients.Group(aggregateId).SendAsync("ReceiveEvent", serializedEvent); }
public void Emit(IEventSourcingEvent e) { On?.Invoke(this, e); }