예제 #1
0
        public IAsyncMessageHandler <TMessage> CreateAsyncMessageHandler <TMessage>(IAsyncMessageHandler <TMessage> handler, AsyncMessageHandlerFilter <TMessage>[] filters)
        {
            var(globalLength, globalFilters)   = options.GetGlobalAsyncMessageHandlerFilters(provider, typeof(TMessage));
            var(handlerLength, handlerFilters) = filterProvider.GetAttributeFilters(handler.GetType(), provider);

            if (filters.Length != 0 || globalLength != 0 || handlerLength != 0)
            {
                handler = new FilterAttachedAsyncMessageHandler <TMessage>(handler, globalFilters.Concat(handlerFilters).Concat(filters).Cast <AsyncMessageHandlerFilter <TMessage> >());
            }

            return(handler);
        }
예제 #2
0
        public IAsyncRequestHandlerCore <TRequest, TResponse> CreateAsyncRequestHandler <TRequest, TResponse>(IAsyncRequestHandlerCore <TRequest, TResponse> handler)
        {
            var(globalLength, globalFilters)   = options.GetGlobalAsyncRequestHandlerFilters(provider, typeof(TRequest), typeof(TResponse));
            var(handlerLength, handlerFilters) = filterProvider.GetAttributeFilters(handler.GetType(), provider);

            if (globalLength != 0 || handlerLength != 0)
            {
                handler = new FilterAttachedAsyncRequestHandler <TRequest, TResponse>(handler, globalFilters.Concat(handlerFilters).Cast <AsyncRequestHandlerFilter <TRequest, TResponse> >());
            }

            return(handler);
        }