コード例 #1
0
ファイル: Interpreter.cs プロジェクト: preardon/Brighter
 internal IEnumerable <RequestHandler <TRequest> > GetHandlers()
 {
     return(new RequestHandlers <TRequest>(
                _registry.Get <TRequest>()
                .Select(handlerType => _handlerFactorySync.Create(handlerType))
                .Cast <IHandleRequests <TRequest> >()));
 }
コード例 #2
0
ファイル: HandlerFactory.cs プロジェクト: preardon/Brighter
        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);
        }