Exemplo n.º 1
0
        public ICommandHandler <TArgs> Create <TArgs>()
        {
            var commandHandler = _provider.GetRequiredService <ICommandHandler <TArgs> >();

            foreach (var decoratorType in _decorators)
            {
                commandHandler = _decoratorFactory.CreateHandler(commandHandler, decoratorType);
            }
            return(commandHandler);
        }
Exemplo n.º 2
0
        public IEnumerable <IEventHandler <TArgs> > Create <TArgs>()
        {
            var eventHandlers = _provider.GetServices <IEventHandler <TArgs> >();

            foreach (var decoratorType in _decorators)
            {
                eventHandlers = eventHandlers.Select(h => _decoratorFactory.CreateHandler(h, decoratorType));
            }
            return(eventHandlers);
        }
Exemplo n.º 3
0
        public IQueryHandler <TArgs, TResult> Create <TArgs, TResult>()
        {
            var queryHandler = _provider.GetRequiredService <IQueryHandler <TArgs, TResult> >();

            foreach (var decoratorType in _decorators)
            {
                queryHandler = _decoratorFactory.CreateHandler(queryHandler, decoratorType);
            }
            return(queryHandler);
        }