private void CheckExecutorConfigDuplicate(CommandExecutorConfig config) { var existsExecutorConfigs = _executorConfigs.Select(e => e.Name); if (existsExecutorConfigs.Contains(config.Name)) { throw new DupilicateExecutorException(); } }
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); }