예제 #1
0
파일: Program.cs 프로젝트: davidich/CodeDOM
        private static void GenerateDtos()
        {
            IEnumerable <TableInfo> tables = DbHelper.GetTableInfos().Result;

            foreach (var table in tables)
            {
                CodeCompileUnit codeGraph = DtoBuilder.Build(table, "MyNamespace");

                var srcPath = "./Dtos/" + table.Name + ".cs";
                FileGenerator.CreateFile(codeGraph, srcPath);
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: davidich/CodeDOM
        private static void RunHelloWorld()
        {
            const string FileName = "HelloWorld";
            const string SrcFile  = FileName + ".cs";
            const string ExeFile  = FileName + ".exe";

            // Create code graph
            CodeCompileUnit codeGraph = HelloWorldBuilder.Build();

            // Generate file based on code graph
            FileGenerator.CreateFile(codeGraph, SrcFile);

            // Compile generated source file into an executable output file
            CodeCompiler.Compile(SrcFile, ExeFile);

            // Execute compiled app
            Process.Start(ExeFile);
        }