public static void Run() { //初始化所有配置文件 ConfigReader.Read(); if (Config.BaseTypeDll != null) { var assembly = Assembly.ReflectionOnlyLoadFrom(Config.BaseTypeDll); //加载所有导入类型 ImportTypePool.Load(assembly); } var tableNameToTables = new Dictionary <string, List <VirtualDataTable> >(); foreach (var file in WalkAllExcelFiles(Config.InputFolder)) { var package = LoadExcelPackage(file.ToString()); foreach (var sheet in package.Workbook.Worksheets) { var table = new VirtualDataTable(file, sheet); tableNameToTables.GetValueOrCreate(table.TableName).Add(table); } } using (var writer = new FileWriter($"{Config.OutputFolder}/ConfigBase.cs")) { TemplateFile.Copy("ConfigBase", writer); } foreach (var kv in tableNameToTables) { var tables = kv.Value; var configType = TypeGenerator.GenerateType(tables); if (Config.OutputType == OutputType.CSharp) { CSharpOutput.Output(configType, tables); } } }