public EntityGenerator(GenerateOption option) { this._option = option; Logger.Level = option.LoggerLevel; // 硬编码;也可以将数据库实现分离到单独的程序集,然后反射装载 switch (_option.DbType.ToLower()) { case "mysql": _tableSelector = new MySQL.MySqlTableSelector(_option); break; case "mssql": _tableSelector = new MsSQL.MsSqlTableSelector(_option); break; default: throw new Exception("暂不支持数据库:" + _option.DbType); } if (!Directory.Exists(option.OutDirectory)) { try { Directory.CreateDirectory(option.OutDirectory); } catch (Exception ex) { throw new Exception("无法创建输出目录", ex); } } }
protected TableSelectorBase(GenerateOption option) { Option = option; }