I want to create a templating engine which sits on top of the asp.net webforms view engine. This is a bit of a shim to simplify an existing XSL based architecture. Instead of using XSL stylesheets, I'll use views. Essentially an end user will create a template by submitting aspx view code to my application. I would like to compile that view to a开发者_如何学C C# class and then render the HTML. Obviously the MVC framework is doing this for aspx files in the views folder but I don't know if that compiling functionality is exposed. Does anyone know how to manually compile a view stored in a string to a C# class or assembly?
Phil Haack has an example using the DLR. This means you're using Ruby or Python instead of C#, but it does work.
精彩评论