Question

As a brief intro, I spent the last few days writing my own template parser/compiler. It's been an interesting project (which I plan to continue) but it sparked some curiosity about how ASP.Net (ASPX, MVC 2/3, or otherwise) handles templates and whether it's modular enough to use in different projects. There also doesn't seem to be much discussion on the topic, so why not ask?

ASP.Net has a lot of nice features:

  • It's a proven system that works well in production
  • Templates are compiled to MSIL
  • It recognizes that files change and recompiles
  • Great debugging support
  • Extensible templates

So here's a question: is it possible to take the template parsing/compiling/debugging system and reuse it for an entirely different purpose? Is it modular, or is it kind of that's-all-that-asp.net-is and you either get it or you don't?

Was it helpful?

Solution

ASPX WebForms pages are not quite flexible enough for general use.
It's possible, but it's a lot of headache. (I've done it)

The new Razor engine is extremely flexible; look at the RazorEngine project for general purpose use.

However, some of the features you're describing (file change monitoring) are part of ASP.Net itself, not Razor, and will only work in an ASP.Net AppDomain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top