Last active
December 12, 2015 02:28
-
-
Save ianbattersby/4698950 to your computer and use it in GitHub Desktop.
Dumping CodeDomUnit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var writer = new StreamWriter(File.Create("c:\\temp\\debug3.txt")); | |
| codeProvider.GenerateCodeFromCompileUnit(razorResult.GeneratedCode, writer, new System.CodeDom.Compiler.CodeGeneratorOptions()); | |
| writer.Flush(); | |
| writer.WriteLine(); | |
| writer.Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Simple.Web.Razor.Engine | |
| { | |
| //------------------------------------------------------------------------------ | |
| // <auto-generated> | |
| // This code was generated by a tool. | |
| // Runtime Version:4.0.30319.17929 | |
| // | |
| // Changes to this file may cause incorrect behavior and will be lost if | |
| // the code is regenerated. | |
| // </auto-generated> | |
| //------------------------------------------------------------------------------ | |
| namespace SimpleRazor | |
| { | |
| using System; | |
| using System.Text; | |
| using System.Linq; | |
| using System.Collections.Generic; | |
| using Simple.Web; | |
| using Simple.Web.Razor; | |
| using Microsoft.CSharp.RuntimeBinder; | |
| public class SimpleView : Simple.Web.Razor.SimpleTemplateModelBase<Simple.Web.Razor.Tests.TestModel> | |
| { | |
| #line hidden | |
| public SimpleView() | |
| { | |
| } | |
| public override void Execute() { | |
| Layout = "~/Views/Layouts/SimpleLayoutWithSections.cshtml"; | |
| WriteLiteral("\r\n\r\n<html>\r\n<body>\r\n<p>"); | |
| Write(Model.Text); | |
| WriteLiteral("</p>\r\n</body>\r\n</html>\r\n\r\n"); | |
| ("One", () => { | |
| WriteLiteral("\r\n <p>I am in section one.</p>\r\n"); | |
| }); | |
| WriteLiteral("\r\n"); | |
| ("Two", () => { | |
| WriteLiteral("\r\n <p>I am in section two.</p>\r\n"); | |
| }); | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.GeneratedClassContext = new GeneratedClassContext( | |
| executeMethodName: "Execute", | |
| writeMethodName: "Write", | |
| writeLiteralMethodName: "WriteLiteral", | |
| writeToMethodName: "WriteTo", | |
| writeLiteralToMethodName: "WriteLiteralTo", | |
| templateTypeName: null, | |
| defineSectionMethodName: "DefineSection"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment