internal IEnumerable <RequestHandler <TRequest> > GetHandlers() { return(new RequestHandlers <TRequest>( _registry.Get <TRequest>() .Select(handlerType => _handlerFactorySync.Create(handlerType)) .Cast <IHandleRequests <TRequest> >())); }
public IHandleRequests <TRequest> CreateRequestHandler() { var handlerType = _attribute.GetHandlerType().MakeGenericType(_messageType); var handler = (IHandleRequests <TRequest>)_factorySync.Create(handlerType); if (handler is null) { throw new ConfigurationException($"Could not create handler {handlerType} from {_factorySync}"); } //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); }