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 <TResult> ReceiveAsync <TResult>(IQuery <TResult> query, CancellationToken cancellationToken = default)
 {
     UpdateCorrelation(query.QueryId);
     return(await _next.ReceiveAsync(query, cancellationToken));
 }
示例#3
0
 public async Task <IActionResult> Query([FromBody] TestQuery query, CancellationToken cancellationToken)
 {
     return(Ok(await _queryReceiver.ReceiveAsync(query, cancellationToken)));
 }