public async Task <IActionResult> Post(CancellationToken cancellationToken) { object result = null; await _httpRequestParser.Parse(HttpContext.Request, async (command, ct) => await _commandReceiver.ReceiveAsync(command, ct), async (query, ct) => result = await _queryReceiver.ReceiveAsync((dynamic)query, ct), async (@event, ct) => await _eventReceiver.ReceiveAsync(@event, ct), cancellationToken); return(result == null ? (IActionResult)Ok() : Ok(JsonConvert.SerializeObject(result, Formatting.None))); }
public async Task ReceiveAsync <TEvent>(TEvent @event, CancellationToken cancellationToken = default) where TEvent : IEvent { UpdateCorrelation(@event.EventId); await _next.ReceiveAsync(@event, cancellationToken); }