开发者

Using ASP.Net templates outside of ASP.Net?

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 wo开发者_如何学Pythonrks 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜