internal IEnumerable <RequestHandler <TRequest> > GetHandlers() { return(new RequestHandlers <TRequest>( _registry.Get <TRequest>() .Select(handlerType => _handlerFactory.Create(handlerType)) .Cast <IHandleRequests <TRequest> >())); }
public IHandleRequests <TRequest> CreateRequestHandler() { var handlerType = _attribute.GetHandlerType().MakeGenericType(_messageType); var handler = (IHandleRequests <TRequest>)_factory.Create(handlerType); //Lod the context before the initializer - in case we want to use the context from within the initializer handler.Context = _requestContext; handler.InitializeFromAttributeParams(_attribute.InitializerParams()); return(handler); }
public IHandleRequests <TRequest> CreateRequestHandler() { var handlerType = _attribute.GetHandlerType().MakeGenericType(_messageType); var handler = (IHandleRequests <TRequest>)_factory.Create(handlerType); if (handler is null) { throw new ConfigurationException($"Could not create handler {handlerType} from {_factory}"); } //Load the context before the initializer - in case we want to use the context from within the initializer handler.Context = _requestContext; handler.InitializeFromAttributeParams(_attribute.InitializerParams()); return(handler); }