public static void UsingCodeDOM() { CodeGenerator codeGenerator = new CodeGenerator(); codeGenerator.ProgrammingLanguage = ProgrammingLanguages.CSharp; codeGenerator.RootNamespace = "RVJ.Core.Sample"; codeGenerator.SourceFileName = "Person.cs"; AssemblyInformation assemblyInfo = new AssemblyInformation(codeGenerator.RootNamespace, new String[] { "System" }); codeGenerator.AssemblyInformation = assemblyInfo; #region Declares and defines a new type. TypeInformation personType = new TypeInformation("Person", codeGenerator.RootNamespace); FieldInformation idField = new FieldInformation("_id", TypeCode.Int32); FieldInformation nameField = new FieldInformation("_name", TypeCode.String); FieldInformation ageField = new FieldInformation("_age", TypeCode.Int32); idField.Attributes = RVJ.Core.CodeDOM.FieldAttributes.Private; nameField.Attributes = RVJ.Core.CodeDOM.FieldAttributes.Private; ageField.Attributes = RVJ.Core.CodeDOM.FieldAttributes.Private; personType.AddFields(new FieldInformation[] { idField, nameField, ageField }); #endregion assemblyInfo.AddType(personType); codeGenerator.Generate(); codeGenerator.Save(); return; }