示例#1
0
        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);
        }
示例#2
0
        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);
        }