public void GenerateBean(JavaBeanConfig javaBeanConfig) { initDefault(); //IRazorEngineCompiledTemplate template = razorEngine.Compile(templateContent);// "Hello @Model.Name"); javaBeanConfig.DDLConfig.Prepare(); string beanRootDir = CodeUtil.PrepareCodeRoot(javaBeanConfig.JavaDiretory, javaBeanConfig.PackageName); string voRootDir = CodeUtil.PrepareCodeRoot(javaBeanConfig.JavaDiretory, javaBeanConfig.VOPackageName); string result = String.Empty; javaBeanConfig.DDLConfig.Tables.ForEach(t => { result = beanTemplate.Run(instance => { javaBeanConfig.Table = t; t.CreatedClass = JavaClass.CreateBoClass(t, javaBeanConfig, true); instance.Model = t.CreatedClass as JavaClass; }); Console.WriteLine(result); string filePath = beanRootDir + Path.DirectorySeparatorChar + t.CreatedClass.ClassName + ".java"; if (File.Exists(filePath)) { File.Delete(filePath); } File.WriteAllText(filePath, result, new UTF8Encoding(false)); result = beanTemplate.Run(instance => { instance.Model = (t.CreatedClass as JavaClass).JavaVoClass; }); Console.WriteLine(result); filePath = voRootDir + Path.DirectorySeparatorChar + (t.CreatedClass as JavaClass).JavaVoClass.ClassName + ".java"; if (File.Exists(filePath)) { File.Delete(filePath); } File.WriteAllText(filePath, result, new UTF8Encoding(false)); }); }