Dynamic views load at runtime from db

Jan 11, 2013 at 4:14 PM

Sorry I copied other's question, because I have exactly the same question.

Can precompiling views be done at runtime? I am working on a project where the end user will be able to modify views stored in the database. What I am wondering is if I can have some kind of "publish" process pull them from the database and pre-compile them into the application. Also, it would be helpful to know if it is possible to "publish" views in the production site this way whether the site would have to be taken offline to do so.

Here is my scenario, we generate a big html report using the xslt which contains several hundred templates, the client can override any templates. So we are planning to use the Razor to replace the xslt. Is it possible to dynamic override any views?

 



Coordinator
Jan 11, 2013 at 5:43 PM

You could take a dependency on RazorGenerator.Core and do this. That said, you could also look at some of the other projects that have more robust support for  runtime generation of templates and do this: 

  • http://nuget.org/packages/RazorEngine
  • https://github.com/jlamfers/RazorMachine/wiki/Examples
Jan 14, 2013 at 11:42 AM

Thank you very much, Pranavkm.

It is what I want to find.