Пример #1
0
        private void CheckExecutorConfigDuplicate(CommandExecutorConfig config)
        {
            var existsExecutorConfigs = _executorConfigs.Select(e => e.Name);

            if (existsExecutorConfigs.Contains(config.Name))
            {
                throw new DupilicateExecutorException();
            }
        }
Пример #2
0
        public ICommandExecutorContainer RegisterExecutor <TExecutor>()
            where TExecutor : class, ICommandExecutor
        {
            var executor       = IocContainer.Resolve <TExecutor>();
            var executorConfig = new CommandExecutorConfig(executor);

            CheckExecutorConfigDuplicate(executorConfig);
            _executorConfigs.Add(executorConfig);
            if (_dbContext == null)
            {
                _dbContext = executor.DbContext;
            }

            return(this);
        }