Exemple #1
0
        public QueryProcessor(IHandlerConfiguration handlerConfiguration, IPolicyRegistry policyRegistry, IRequestContextFactory requestContextFactory)
        {
            if (handlerConfiguration == null)
            {
                throw new ArgumentNullException(nameof(handlerConfiguration));
            }
            if (policyRegistry == null)
            {
                throw new ArgumentNullException(nameof(policyRegistry));
            }
            if (requestContextFactory == null)
            {
                throw new ArgumentNullException(nameof(requestContextFactory));
            }

            if (handlerConfiguration.HandlerRegistry == null)
            {
                throw new ArgumentException($"{nameof(handlerConfiguration.HandlerRegistry)} must not be null", nameof(handlerConfiguration));
            }
            if (handlerConfiguration.HandlerFactory == null)
            {
                throw new ArgumentException($"{nameof(handlerConfiguration.HandlerFactory)} must not be null", nameof(handlerConfiguration));
            }
            if (handlerConfiguration.DecoratorFactory == null)
            {
                throw new ArgumentException($"{nameof(handlerConfiguration.DecoratorFactory)} must not be null", nameof(handlerConfiguration));
            }

            _handlerRegistry       = handlerConfiguration.HandlerRegistry;
            _handlerFactory        = handlerConfiguration.HandlerFactory;
            _decoratorFactory      = handlerConfiguration.DecoratorFactory;
            _policyRegistry        = policyRegistry;
            _requestContextFactory = requestContextFactory;
        }
Exemple #2
0
 public Execute(ICommandHandlerFactory commandHandlerFactory,
                IQueryHandlerFactory queryHandlerFactory,
                IAsyncQueryHandlerFactory asyncQueryHandlerFactory)
 {
     this.queryHandlerFactory      = queryHandlerFactory ?? throw new ArgumentNullException(nameof(queryHandlerFactory));
     this.asyncQueryHandlerFactory = asyncQueryHandlerFactory ?? throw new ArgumentNullException(nameof(asyncQueryHandlerFactory));
     this.commandHandlerFactory    = commandHandlerFactory ?? throw new ArgumentNullException(nameof(commandHandlerFactory));
 }
 public HomeController(ILogger <HomeController> logger, ISwapiRestCaller caller,
                       ICommandHandlerFactory commfac, IQueryHandlerFactory queryFac)
 {
     _logger   = logger;
     _caller   = caller;
     _commFac  = commfac;
     _queryfac = queryFac;
 }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of <see cref="QueryDispatcher"/> class with handler factory.
        /// </summary>
        /// <param name="commandHandlerFactory">An object that creates handlers.</param>
        public QueryDispatcher(IQueryHandlerFactory commandHandlerFactory)
        {
            if (commandHandlerFactory == null)
            {
                throw new ArgumentNullException(nameof(commandHandlerFactory));
            }

            _commandHandlerFactory = commandHandlerFactory;
        }
 public ValidatingQueryRunner(
     IQueryHandlerFactory queryHandlerFactory,
     IQueryValidatorSource queryValidatorSource)
     : base(queryHandlerFactory)
 {
     this.QueryValidatorSource =
         queryValidatorSource
         ??
         throw new ArgumentNullException(nameof(queryValidatorSource));
 }
        public void Init()
        {
            var catalog = new QueryCatalog(new Collection <QueryEntry>
            {
                new QueryEntry(typeof(Query1), typeof(MockQueryHandler <Query1, Query1.Result>)),
                new QueryEntry(typeof(Query2), typeof(MockReusableQueryHandler <Query2, Query2.Result>))
            });

            _factory = new QueryHandlerFactory(catalog);
        }
 public HandlerConfiguration(
     IQueryHandlerRegistry handlerRegistry,
     IQueryHandlerFactory handlerFactory,
     IQueryHandlerDecoratorRegistry decoratorRegistry,
     IQueryHandlerDecoratorFactory decoratorFactory)
 {
     HandlerRegistry   = handlerRegistry ?? throw new ArgumentNullException(nameof(handlerRegistry));
     HandlerFactory    = handlerFactory ?? throw new ArgumentNullException(nameof(handlerFactory));
     DecoratorRegistry = decoratorRegistry ?? throw new ArgumentNullException(nameof(decoratorRegistry));
     DecoratorFactory  = decoratorFactory ?? throw new ArgumentNullException(nameof(decoratorFactory));
 }
Exemple #8
0
        public QueryProcessor(
            IHandlerConfiguration handlerConfiguration,
            IQueryContextFactory queryContextFactory,
            IReadOnlyDictionary <string, object> contextBagData = null)
        {
            if (handlerConfiguration == null)
            {
                throw new ArgumentNullException(nameof(handlerConfiguration));
            }

            _handlerRegistry  = handlerConfiguration.HandlerRegistry ?? throw new ArgumentException($"{nameof(handlerConfiguration.HandlerRegistry)} must not be null", nameof(handlerConfiguration));
            _handlerFactory   = handlerConfiguration.HandlerFactory ?? throw new ArgumentException($"{nameof(handlerConfiguration.HandlerFactory)} must not be null", nameof(handlerConfiguration));
            _decoratorFactory = handlerConfiguration.DecoratorFactory ?? throw new ArgumentException($"{nameof(handlerConfiguration.DecoratorFactory)} must not be null", nameof(handlerConfiguration));

            _queryContextFactory = queryContextFactory ?? throw new ArgumentNullException(nameof(queryContextFactory));
            _contextBagData      = contextBagData ?? new Dictionary <string, object>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataContextScopeFactory" /> class.
        /// </summary>
        /// <param name="repositoryFactory">The <see cref="IRepositoryFactory" /> factory.</param>
        /// <param name="queryHandlerFactory">The <see cref="IQueryHandlerFactory" /> factory.</param>
        /// <param name="commandHandlerFactory">The <see cref="ICommandHandlerFactory" /> factory.</param>
        public DataContextScopeFactory(IRepositoryFactory repositoryFactory = null, IQueryHandlerFactory queryHandlerFactory = null, ICommandHandlerFactory commandHandlerFactory = null)
        {
            if (repositoryFactory != null)
            {
                this.repositoryFactory = repositoryFactory;
            }

            if (queryHandlerFactory != null)
            {
                this.queryHandlerFactory = queryHandlerFactory;
            }

            if (commandHandlerFactory != null)
            {
                this.commandHandlerFactory = commandHandlerFactory;
            }
        }
Exemple #10
0
        public DefaultMediator(IQueryHandlerFactory queryHandlerFactory,
                               ICommandHandlerFactory commandHandlerFactory,
                               IDomainEventHandlerFactory eventHandlerFactory)
        {
            if (queryHandlerFactory == null)
            {
                throw new ArgumentNullException(nameof(queryHandlerFactory));
            }

            if (commandHandlerFactory == null)
            {
                throw new ArgumentNullException(nameof(commandHandlerFactory));
            }

            if (eventHandlerFactory == null)
            {
                throw new ArgumentNullException(nameof(eventHandlerFactory));
            }

            _queryHandlerFactory   = queryHandlerFactory;
            _commandHandlerFactory = commandHandlerFactory;
            _eventHandlerFactory   = eventHandlerFactory;
        }
Exemple #11
0
 public LogController(ICommandBus commandBus, IQueryHandlerFactory queryHandlerFactory)
     : base(commandBus, queryHandlerFactory)
 {
 }
Exemple #12
0
 public SystemController(IQueryHandlerFactory queryHandlerFactory)
 {
     this.queryHandlerFactory = queryHandlerFactory;
 }
Exemple #13
0
 public QueryRunner(IQueryHandlerFactory queryHandlerFactory)
 {
     QueryHandlerFactory = queryHandlerFactory ?? throw new ArgumentNullException(nameof(queryHandlerFactory));
 }
Exemple #14
0
 public QueryBus(IQueryHandlerFactory queryHandlerFactory,
                 IExceptionTypeResolver exceptionTypeResolver)
 {
     this.queryHandlerFactory   = queryHandlerFactory;
     this.exceptionTypeResolver = exceptionTypeResolver;
 }
Exemple #15
0
 public Executor(ICommandHandlerFactory commandFactory, IQueryHandlerFactory queryFactory)
 {
     this.commandFactory = commandFactory;
     this.queryFactory   = queryFactory;
 }
 public KlinkedCqrsBus(IServiceProvider provider, CqrsOptions options)
 {
     _queryHandlerFactory   = new QueryHandlerFactory(provider, options.QueryDecorators);
     _commandHandlerFactory = new CommandHandlerFactory(provider, options.CommandDecorators);
     _eventHandlerFactory   = new EventHandlerFactory(provider, options.EventDecorators);
 }
Exemple #17
0
 public QueryHandlerDispatcher(IQueryHandlerFactory factory)
 {
     _factory = factory;
 }
 public QueryDispatcher(IQueryHandlerFactory queryHandlerFactory)
 {
     this.queryHandlerFactory = queryHandlerFactory;
 }
Exemple #19
0
 public RxQueryDispatcher(IQueryHandlerFactory commandHandlerFactory, SynchronizationContext ctx) : base(commandHandlerFactory)
 {
     _ctx = ctx;
 }
 public MediatorService(IQueryHandlerFactory queryHandlerFactory)
 {
     _queryHandlerFactory = queryHandlerFactory;
 }