public INeedAQueryContext Handlers(IQueryHandlerRegistry handlerRegistry, Func <Type, IQueryHandler> handlerFactory, Action <Type> decoratorRegistry, Func <Type, IQueryHandlerDecorator> decoratorFactory) { if (handlerRegistry == null) { throw new ArgumentNullException(nameof(handlerRegistry)); } if (handlerFactory == null) { throw new ArgumentNullException(nameof(handlerFactory)); } if (decoratorRegistry == null) { throw new ArgumentNullException(nameof(decoratorRegistry)); } if (decoratorFactory == null) { throw new ArgumentNullException(nameof(decoratorFactory)); } _handlerConfiguration = new HandlerConfiguration( handlerRegistry, new FactoryFuncWrapper(handlerFactory), new RegistryActionWrapper(decoratorRegistry), new FactoryFuncWrapper(decoratorFactory)); return(this); }
public QueryProcessor( IQueryHandlerRegistry registry, IQueryHandlerFactory factory) { _registry = registry; _factory = factory; }
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; }
public void BootstrapQueries( IQueryHandlerRegistry queryHandlerRegistry, IEventBus eventBus, IQueryDispatcher queryDispatcher) { var personView = new PersonView(); queryHandlerRegistry.SetHandler <GetPersonIdByNameQuery, object>(personView.Execute); queryHandlerRegistry.SetHandler <GetPeopleNamesQuery, IEnumerable <PersonName> >(personView.Execute); eventBus.RegisterListener <PersonCreatedEvent>(personView.Update); var journeysByPassengerThenMonthThenDayView = new JourneysByPassengerThenMonthThenDayView(); queryHandlerRegistry.SetHandler <GetJourneysByPassengerThenMonthThenDayQuery, IEnumerable <Fact> >(journeysByPassengerThenMonthThenDayView.Execute); eventBus.RegisterListener <JourneyCreatedEvent>(journeysByPassengerThenMonthThenDayView.Update); eventBus.RegisterListener <LiftAddedEvent>(journeysByPassengerThenMonthThenDayView.Update); var journeyView = new JourneyView(); queryHandlerRegistry.SetHandler <GetJourneysInPeriodQuery, IEnumerable <Journey> >(journeyView.Execute); eventBus.RegisterListener <JourneyCreatedEvent>(journeyView.Update); eventBus.RegisterListener <LiftAddedEvent>(journeyView.Update); var passengerLiftsCostCalculator = new PassengerLiftCostCalculator(queryDispatcher); queryHandlerRegistry.SetHandler <GetCostOfPassengerLiftsInPeriodQuery, PassengerLiftsCost>(passengerLiftsCostCalculator.Execute); }
public INeedAQueryContext Handlers(IQueryHandlerRegistry handlerRegistry, IQueryHandlerFactory handlerFactory, IQueryHandlerDecoratorRegistry decoratorRegistry, IQueryHandlerDecoratorFactory decoratorFactory) { if (handlerRegistry == null) { throw new ArgumentNullException(nameof(handlerRegistry)); } if (handlerFactory == null) { throw new ArgumentNullException(nameof(handlerFactory)); } if (decoratorRegistry == null) { throw new ArgumentNullException(nameof(decoratorRegistry)); } if (decoratorFactory == null) { throw new ArgumentNullException(nameof(decoratorFactory)); } _handlerConfiguration = new HandlerConfiguration( handlerRegistry, handlerFactory, decoratorRegistry, decoratorFactory); return(this); }
public FallbackPolicyTests() { _handlerFactory = new Mock <IQueryHandlerFactory>(); _decoratorFactory = new Mock <IQueryHandlerDecoratorFactory>(); _handlerRegistry = new QueryHandlerRegistry(); var handlerConfiguration = new HandlerConfiguration(_handlerRegistry, _handlerFactory.Object, _decoratorFactory.Object); _queryProcessor = new QueryProcessor(handlerConfiguration, new InMemoryQueryContextFactory()); }
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)); }
public Bootstrapper( IEventBus eventBus, ICommandDispatcher commandDispatcher, ICommandHandlerRegistry commandHandlerRegistry, IQueryDispatcher queryDispatcher, IQueryHandlerRegistry queryHandlerRegistry, IIdFactory idFactory) { _eventBus = eventBus; _commandDispatcher = commandDispatcher; _commandHandlerRegistry = commandHandlerRegistry; _queryDispatcher = queryDispatcher; _queryHandlerRegistry = queryHandlerRegistry; _idFactory = idFactory; }
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>(); }
public INeedPolicies Handlers(IQueryHandlerRegistry handlerRegistry, Func <Type, object> handlerFactory, Func <Type, object> decoratorFactory) { if (handlerRegistry == null) { throw new ArgumentNullException(nameof(handlerRegistry)); } if (handlerFactory == null) { throw new ArgumentNullException(nameof(handlerFactory)); } if (decoratorFactory == null) { throw new ArgumentNullException(nameof(decoratorFactory)); } _handlerConfiguration = new HandlerConfiguration(handlerRegistry, new FactoryFuncWrapper(handlerFactory), new FactoryFuncWrapper(decoratorFactory)); return(this); }
public AspNetDependencyInjectionHandlerConfigurationBuilder(IServiceCollection services) { _services = services; _handlerRegistry = new QueryHandlerRegistry(); }
public QueryProcessor(IServiceProvider serviceProvider, IQueryHandlerRegistry queryHandlerRegistry) { _serviceProvider = serviceProvider; _registry = queryHandlerRegistry; }
public QueryDispatcher(IQueryHandlerRegistry queryRegistry) { _queryRegistry = queryRegistry; }
public SimpleInjectorHandlerConfigurationBuilder(Container container) { _container = container; _handlerRegistry = new QueryHandlerRegistry(); }
public HandlerSettings(Container container, IQueryHandlerRegistry handlerRegistry) { _container = container; _handlerRegistry = handlerRegistry; }
public PipelineBuilder(IQueryHandlerRegistry handlerRegistry, IQueryHandlerFactory handlerFactory, IQueryHandlerDecoratorFactory decoratorFactory) { _handlerRegistry = handlerRegistry; _handlerFactory = handlerFactory; _decoratorFactory = decoratorFactory; }
public HandlerConfiguration(IQueryHandlerRegistry handlerRegistry, SimpleInjectorHandlerFactory factory) { HandlerRegistry = handlerRegistry; HandlerFactory = factory; DecoratorFactory = factory; }
public AspNetDependencyInjectionHandlerConfiguration(IQueryHandlerRegistry handlerRegistry, AspNetDependencyInjectionHandlerFactory factory) { HandlerRegistry = handlerRegistry; HandlerFactory = factory; DecoratorFactory = factory; }