Пример #1
0
 public JsonLogger(string source, string category, Func <string, LogLevel, bool> filter,
                   ICommandContextManager commandContextManager)
 {
     _category = category;
     _filter   = filter;
     _commandContextManager = commandContextManager;
 }
Пример #2
0
 public CaseReportsProcessor(
     ICommandContextManager commandContextManager,
     IAggregateRootRepositoryFor <CaseReporting> caseReportingRepository)
 {
     _commandContextManager   = commandContextManager;
     _caseReportingRepository = caseReportingRepository;
 }
Пример #3
0
 public TextMessageProcessors(
     IInstancesOf <ICanProcessTextMessage> processors,
     ICommandContextManager commandContextManager,
     ILogger logger)
 {
     _processors            = processors;
     _commandContextManager = commandContextManager;
     _logger = logger;
 }
 /// <summary>
 /// Instantiates an instance of <see cref="ImprovementResultHandler" />
 /// </summary>
 /// <param name="executionContextManager">An <see cref="IExecutionContextManager" /> for accessing the current <see cref="ExecutionContext" /></param>
 /// <param name="commandContextManager">An <see cref="ICommandContextManager" /> for creating a <see cref="ICommandContext" /></param>
 /// <param name="repository">A repository for accessing a <see cref="Improvement" /></param>
 public ImprovementResultHandler(
     IExecutionContextManager executionContextManager,
     ICommandContextManager commandContextManager,
     IAggregateRootRepositoryFor <Improvement> repository)
 {
     _executionContextManager = executionContextManager;
     _commandContextManager   = commandContextManager;
     _repository = repository;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AggregateOf{T}"/> class.
 /// </summary>
 /// <param name="commandContextManager"> <see cref="ICommandContextManager"/> to use for tracking.</param>
 /// <param name="eventStore">The <see cref="IEventStore" />.</param>
 /// <param name="logger"><see cref="ILogger"/> to use for logging.</param>
 public AggregateOf(
     ICommandContextManager commandContextManager,
     IEventStore eventStore,
     ILogger logger)
 {
     _commandContextManager = commandContextManager;
     _eventStore            = eventStore;
     _logger = logger;
 }
Пример #6
0
 public Reactions(
     IExecutionContextManager executionContextManager,
     ICommandContextManager commandContextManager,
     IContainer container)
 {
     _executionContextManager = executionContextManager;
     _commandContextManager   = commandContextManager;
     _container = container;
 }
Пример #7
0
        public ILogger CreateLogger(string categoryName)
        {
            ICommandContextManager commandContextManager = null;

            // Todo: Needs a proper correlation Id from real / current command context manager
            // find a way to retrieve this
            commandContextManager = new NullCommandContextManager();

            return(new JsonLogger(_source, categoryName, _filter, commandContextManager));
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of <see cref="AggregateRootRepository{T}">AggregatedRootRepository</see>
 /// </summary>
 /// <param name="commandContextManager"> <see cref="ICommandContextManager"/> to use for tracking </param>
 /// <param name="eventStore"><see cref="IEventStore"/> for getting <see cref="IEvent">events</see></param>
 /// <param name="eventSourceVersions"><see cref="IEventSourceVersions"/> for working with versioning of <see cref="AggregateRoot"/></param>
 /// <param name="applicationResources"><see cref="IApplicationResources"/> for being able to identify resources</param>
 public AggregateRootRepository(
     ICommandContextManager commandContextManager,
     IEventStore eventStore,
     IEventSourceVersions eventSourceVersions,
     IApplicationResources applicationResources)
 {
     _commandContextManager = commandContextManager;
     _eventStore            = eventStore;
     _eventSourceVersions   = eventSourceVersions;
     _applicationResources  = applicationResources;
 }
Пример #9
0
 public AlertRulesInvoker(
     ICommandContextManager commandContextManager,
     IReadModelRepositoryFor <Report> reportsRepository,
     IAlertRuleRunnerFactory alertRuleRunnerFactory,
     IAggregateRootRepositoryFor <AlertsDomain.Alerts> aggregateRootRepository)
 {
     _commandContextManager   = commandContextManager;
     _reportsRepository       = reportsRepository;
     _alertRuleRunnerFactory  = alertRuleRunnerFactory;
     _aggregateRootRepository = aggregateRootRepository;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandCoordinator">CommandCoordinator</see>
 /// </summary>
 /// <param name="commandHandlerManager">A <see cref="ICommandHandlerManager"/> for handling commands</param>
 /// <param name="commandContextManager">A <see cref="ICommandContextManager"/> for establishing a <see cref="CommandContext"/></param>
 /// <param name="commandSecurityManager">A <see cref="ICommandSecurityManager"/> for dealing with security and commands</param>
 /// <param name="commandValidators">A <see cref="ICommandValidators"/> for validating a <see cref="ICommand"/> before handling</param>
 /// <param name="localizer">A <see cref="ILocalizer"/> to use for controlling localization of current thread when handling commands</param>
 public CommandCoordinator(
     ICommandHandlerManager commandHandlerManager,
     ICommandContextManager commandContextManager,
     ICommandSecurityManager commandSecurityManager,
     ICommandValidators commandValidators,
     ILocalizer localizer)
 {
     _commandHandlerManager    = commandHandlerManager;
     _commandContextManager    = commandContextManager;
     _commandSecurityManager   = commandSecurityManager;
     _commandValidationService = commandValidators;
     _localizer = localizer;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="commandContextManager"></param>
 /// <param name="repository"></param>
 /// <param name="improvementPodFactory"></param>
 public ImprovementStepResultHandler(
     IExecutionContextManager executionContextManager,
     ICommandContextManager commandContextManager,
     IAggregateRootRepositoryFor <Improvement> repository,
     IImprovementContextFactory improvementContextFactory,
     IRecipeLocator recipeLocator)
 {
     _executionContextManager = executionContextManager;
     _commandContextManager   = commandContextManager;
     _repository = repository;
     _improvementContextFactory = improvementContextFactory;
     _recipeLocator             = recipeLocator;
 }
Пример #12
0
		/// <summary>
		/// Initializes a new instance of the <see cref="CommandCoordinator">CommandCoordinator</see>
		/// </summary>
		/// <param name="commandHandlerManager">A <see cref="ICommandHandlerManager"/> for handling commands</param>
		/// <param name="commandContextManager">A <see cref="ICommandContextManager"/> for establishing a <see cref="CommandContext"/></param>
        /// <param name="commandSecurityManager">A <see cref="ICommandSecurityManager"/> for dealing with security and commands</param>
		/// <param name="commandValidationService">A <see cref="ICommandValidationService"/> for validating a <see cref="ICommand"/> before handling</param>
		/// <param name="localizer">A <see cref="ILocalizer"/> to use for controlling localization of current thread when handling commands</param>
		public CommandCoordinator(
			ICommandHandlerManager commandHandlerManager,
			ICommandContextManager commandContextManager,
            ICommandSecurityManager commandSecurityManager,
            ICommandValidationService commandValidationService,
			ILocalizer localizer)
		{
			_commandHandlerManager = commandHandlerManager;
			_commandContextManager = commandContextManager;
            _commandSecurityManager = commandSecurityManager;
		    _commandValidationService = commandValidationService;
	    	_localizer = localizer;
		}
Пример #13
0
 public NotificationProcessor(
     ICommandContextManager commandContextManager,
     IReadModelRepositoryFor <DataCollector> dataCollectors,
     IReadModelRepositoryFor <HealthRisk> healthRisks,
     INotificationParser textMessageParser,
     IAggregateRootRepositoryFor <CaseReporting> caseReportingRepository)
 {
     _commandContextManager   = commandContextManager;
     _dataCollectors          = dataCollectors;
     _healthRisks             = healthRisks;
     _textMessageParser       = textMessageParser;
     _caseReportingRepository = caseReportingRepository;
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of <see cref="AggregateRootRepositoryFor{T}">AggregatedRootRepository</see>
 /// </summary>
 /// <param name="commandContextManager"> <see cref="ICommandContextManager"/> to use for tracking </param>
 /// <param name="eventStore"><see cref="IEventStore"/> for getting <see cref="IEvent">events</see></param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for being able to identify resources</param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> to construct an instance of a Type from a <see cref="PropertyBag" /></param>
 /// <param name="logger"><see cref="ILogger"/> to use for logging</param>
 public AggregateRootRepositoryFor(
     ICommandContextManager commandContextManager,
     IEventStore eventStore,
     IArtifactTypeMap artifactTypeMap,
     IObjectFactory objectFactory,
     ILogger logger)
 {
     _commandContextManager = commandContextManager;
     _eventStore            = eventStore;
     _artifactTypeMap       = artifactTypeMap;
     _logger        = logger;
     _objectFactory = objectFactory;
 }
Пример #15
0
        public AlertRulesProcessor(

            ICommandContextManager commandContextManager,
            IAggregateRootRepositoryFor <Domain.Alerts.Alerts> alertsAggregateRootRepository,
            IReadModelRepositoryFor <Read.Reports.Report> reportRepository,
            IReadModelRepositoryFor <Read.AlertRules.AlertRule> alertRuleRepository

            )
        {
            _commandContextManager         = commandContextManager;
            _alertsAggregateRootRepository = alertsAggregateRootRepository;
            _reportRepository    = reportRepository;
            _alertRuleRepository = alertRuleRepository;
        }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandCoordinator">CommandCoordinator</see>
 /// </summary>
 /// <param name="commandHandlerManager">A <see cref="ICommandHandlerManager"/> for handling commands</param>
 /// <param name="commandContextManager">A <see cref="ICommandContextManager"/> for establishing a <see cref="CommandContext"/></param>
 /// <param name="commandSecurityManager">A <see cref="ICommandSecurityManager"/> for dealing with security and commands</param>
 /// <param name="commandValidators">A <see cref="ICommandValidators"/> for validating a <see cref="ICommand"/> before handling</param>
 /// <param name="localizer">A <see cref="ILocalizer"/> to use for controlling localization of current thread when handling commands</param>
 /// <param name="exceptionPublisher">An <see cref="IExceptionPublisher"/> to send exceptions to</param>
 public CommandCoordinator(
     ICommandHandlerManager commandHandlerManager,
     ICommandContextManager commandContextManager,
     ICommandSecurityManager commandSecurityManager,
     ICommandValidators commandValidators,
     ILocalizer localizer,
     IExceptionPublisher exceptionPublisher)
 {
     _commandHandlerManager = commandHandlerManager;
     _commandContextManager = commandContextManager;
     _commandSecurityManager = commandSecurityManager;
     _commandValidationService = commandValidators;
     _localizer = localizer;
     _exceptionPublisher = exceptionPublisher;
 }
Пример #17
0
        public CommandScenario()
        {
            principal = new GenericPrincipal(new GenericIdentity("test"), new string[] { });

            event_source    = new Mock <IEventSource>();
            GeneratedEvents = new UncommittedEventStream(event_source.Object);
            uncommitted_event_stream_coordinator = new Mock <IUncommittedEventStreamCoordinator>();
            process_method_invoker         = new Mock <IProcessMethodInvoker>();
            call_context_mock              = new Mock <ICallContext>();
            execution_context_factory_mock = new Mock <IExecutionContextFactory>();
            execution_context_manager      = new ExecutionContextManager(execution_context_factory_mock.Object, call_context_mock.Object);
            command_context_factory        = new CommandContextFactory(uncommitted_event_stream_coordinator.Object, process_method_invoker.Object, execution_context_manager);
            command_context_manager        = new CommandContextManager(command_context_factory);

            command_handler_manager = new Mock <ICommandHandlerManager>();
            command_handler_manager.Setup(m => m.Handle(It.IsAny <ICommand>())).Callback((ICommand c) => command_handler.Handle((dynamic)c));

            localizer = new Mock <ILocalizer>();

            command_validators_mock = new Mock <ICommandValidators>();

            command_security_manager_mock = new Mock <ICommandSecurityManager>();
            //TODO: Allow spec'ing of Security
            command_security_manager_mock.Setup(s => s.Authorize(It.IsAny <ICommand>())).Returns(new AuthorizationResult());

            command_coordinator = new CommandCoordinator(
                command_handler_manager.Object,
                command_context_manager,
                command_security_manager_mock.Object,
                command_validators_mock.Object,
                localizer.Object,
                Mock.Of <IExceptionPublisher>(),
                Mock.Of <ILogger>());

            null_validator_mock = new Mock <ICanValidate <T> >();
            null_validator      = null_validator_mock.Object;
            input_validator     = null_validator;
            business_validator  = null_validator;

            uncommitted_event_stream_coordinator.Setup(es => es.Commit(It.IsAny <TransactionCorrelationId>(), It.IsAny <UncommittedEventStream>()))
            .Callback((TransactionCorrelationId i, UncommittedEventStream ues) => RecordGeneratedEvents(ues));
        }
Пример #18
0
 public DeviceRequests(ICommandContextManager commandContextManager, IApplicationArtifacts artifacts)
 {
     _nullCommandIdentifier = artifacts.Identify(typeof(Domain.NullCommand));
     _commandContextManager = commandContextManager;
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of <see cref="AggregateRootRepository{T}">AggregatedRootRepository</see>
 /// </summary>
 /// <param name="commandContextManager"> <see cref="ICommandContextManager"/> to use for tracking </param>
 public AggregateRootRepository(ICommandContextManager commandContextManager)
 {
     _commandContextManager = commandContextManager;
 }