示例#1
0
        public IRequestReceivePipe <IReceiveContext <IRequest> > Build()
        {
            IRequestReceivePipe <IReceiveContext <IRequest> > current = null;

            if (_specifications.Any())
            {
                for (int i = _specifications.Count - 1; i >= 0; i--)
                {
                    if (i == _specifications.Count - 1)
                    {
                        var thisPipe =
                            new RequestPipe <IReceiveContext <IRequest> >(_specifications[i], null, _resolver);
                        current = thisPipe;
                    }
                    else
                    {
                        var thisPipe =
                            new RequestPipe <IReceiveContext <IRequest> >(_specifications[i], current, _resolver);
                        current = thisPipe;
                    }
                }
            }
            else
            {
                current = new RequestPipe <IReceiveContext <IRequest> >(new EmptyPipeSpecification <IReceiveContext <IRequest> >(), null, _resolver);
            }

            return(current);
        }
示例#2
0
 public Mediator(ICommandReceivePipe <IReceiveContext <ICommand> > commandReceivePipe,
                 IEventReceivePipe <IReceiveContext <IEvent> > eventReceivePipe,
                 IRequestReceivePipe <IReceiveContext <IRequest> > requestPipe,
                 IPublishPipe <IPublishContext <IEvent> > publishPipe,
                 IGlobalReceivePipe <IReceiveContext <IMessage> > globalPipe, IDependancyScope scope = null)
 {
     _commandReceivePipe = commandReceivePipe;
     _eventReceivePipe   = eventReceivePipe;
     _requestPipe        = requestPipe;
     _publishPipe        = publishPipe;
     _globalPipe         = globalPipe;
     _scope = scope;
 }
示例#3
0
        public IRequestReceivePipe <IReceiveContext <IRequest> > Build()
        {
            IRequestReceivePipe <IReceiveContext <IRequest> > current = null;

            if (_specifications.Any())
            {
                for (int i = _specifications.Count - 1; i >= 0; i--)
                {
                    current = i == _specifications.Count - 1
                        ? new RequestPipe <IReceiveContext <IRequest> >(_specifications[i], null, _resolver, _messageHandlerRegistry)
                        : new RequestPipe <IReceiveContext <IRequest> >(_specifications[i], current, _resolver, _messageHandlerRegistry);
                }
            }
            else
            {
                current = new RequestPipe <IReceiveContext <IRequest> >(new EmptyPipeSpecification <IReceiveContext <IRequest> >(), null, _resolver, _messageHandlerRegistry);
            }

            return(current);
        }