public async ICovariantAwaitable <QueryDispatchResult> HandleAsync(DispatchQuery message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } Console.WriteLine($"Receiving 'DispatchQuery' for query type '{message.QueryType.FullName}' with query '{message.Query}'."); var answer = new QueryDispatchResult(await _queryDispatcher.DispatchAsync(message.QueryType, message.Query)); return(answer); }
public async Task <IQueryResult> DispatchAsync <TQuery>(TQuery query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } var message = new DispatchQuery(typeof(TQuery), query); Console.WriteLine($"Sending 'DispatchQuery' for query type '{message.QueryType.FullName}' with query '{message.Query}'."); var answer = await _messageEndPoint.SendAsync <DispatchQuery, QueryDispatchResult>(message); return(answer.QueryResult); }