Esempio n. 1
0
        public ConnectedProjectionsManager(
            IMigrationHelper migrationHelper,
            IRegisteredProjections registeredProjections,
            IConnectedProjectionsCommandBus commandBus,
            IConnectedProjectionsCommandBusHandlerConfiguration commandBusHandlerConfiguration,
            IConnectedProjectionsCommandHandler commandHandler)
        {
            _registeredProjections = registeredProjections ?? throw new ArgumentNullException(nameof(registeredProjections));
            _commandBus            = commandBus ?? throw new ArgumentNullException(nameof(commandBus));

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

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

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

            commandBusHandlerConfiguration.Register(commandHandler);

            migrationHelper.RunMigrations();
        }
Esempio n. 2
0
        public void Register(IConnectedProjectionsCommandHandler commandHandler)
        {
            if (_commandHandler != null)
            {
                throw new Exception("CommandHandler is already assigned");
            }

            _commandHandler = commandHandler ?? throw new ArgumentNullException(nameof(commandHandler));
        }