示例#1
0
        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());
        }