Пример #1
0
        public async Task <TResponse> Handle(Routed <TResponse> message)
        {
            var route   = message.Route;
            var request = message.Request;

            var router = _routers.FirstOrDefault(r => r.CanRoute(message, request));

            if (router == null)
            {
                throw new NotSupportedException($"Unrecognized request route '{route}'");
            }

            var response = await router.Route(message, request, _mediator);

            return((TResponse)response);
        }
 public bool CanRoute(Routed route, object message)
 {
     return(route.Route == "pass-through");
 }
 public Task <object> Route(Routed route, object message, IMediator mediator)
 {
     return(DynamicDispatch.Dispatch(mediator, message));
 }