예제 #1
0
        private void RegisterServiceIfRequired <TMessage>(IReceiveContext <TMessage> receiveContext) where  TMessage : IMessage
        {
            receiveContext.RegisterService(this);
            if (!receiveContext.TryGetService(out IPublishPipe <IPublishContext <IEvent> > _))
            {
                receiveContext.RegisterService(_publishPipe);
            }

            if (!receiveContext.TryGetService(out ICommandReceivePipe <IReceiveContext <ICommand> > _))
            {
                receiveContext.RegisterService(_commandReceivePipe);
            }

            if (!receiveContext.TryGetService(out IEventReceivePipe <IReceiveContext <IEvent> > _))
            {
                receiveContext.RegisterService(_eventReceivePipe);
            }

            if (!receiveContext.TryGetService(out IRequestReceivePipe <IReceiveContext <IRequest> > _))
            {
                receiveContext.RegisterService(_requestPipe);
            }
        }