private string GenerateTables(CodeDomProvider codeDomProvider, CodeGeneratorOptions options, CodeGenerationInfo generationInfo) { var sb = new StringBuilder(); using (var sw = new StringWriter(sb)) { var codeGenerator = codeDomProvider.CreateGenerator(sw); var compileUnit = new CodeCompileUnit(); compileUnit.AddCustomInclude($"{generationInfo.RelativePath}reader/include/crema/inidata"); compileUnit.AddCustomInclude($"{generationInfo.Prefix}types{generationInfo.Postfix}"); compileUnit.AddCustomInclude($"{generationInfo.RelativePath}crema_base"); var codeNamespace = new CodeNamespace(generationInfo.Namespace); codeNamespace.Imports.Add(new CodeNamespaceImport(generationInfo.ReaderNamespace)); CremaDataClassCreator.Create(codeNamespace, generationInfo); compileUnit.Namespaces.Add(codeNamespace); codeGenerator.GenerateCodeFromCompileUnit(compileUnit, sw, options); } return(sb.ToString()); }
private string GenerateTables(CodeDomProvider codeDomProvider, CodeGeneratorOptions options, CodeGenerationInfo generationInfo) { StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) { var codeGenerator = codeDomProvider.CreateGenerator(sw); CodeCompileUnit compileUnit = new CodeCompileUnit(); //compileUnit.AddCustomInclude("reader/include/crema/inidata"); compileUnit.AddInclude("crema/inidata"); compileUnit.AddCustomInclude("crema_datatypes"); //compileUnit.AddCustomInclude("crema_base"); CodeNamespace codeNamespace = new CodeNamespace(generationInfo.Namespace); codeNamespace.Imports.Add(new CodeNamespaceImport(generationInfo.ReaderNamespace)); foreach (var item in generationInfo.GetTables()) { H3RowClassCreator.Create(codeNamespace, item, generationInfo); } compileUnit.Namespaces.Add(codeNamespace); codeGenerator.GenerateCodeFromCompileUnit(compileUnit, sw, options); } return(sb.ToString()); }