Antaris/RazorEngine — Issue #2: Best practices for web app
Author: Madd0g
Created: 2011-11-21 23:17:59+00:00
State: open

Hi,

I want to use RazorEngine in an MVC app.
I want to have several templates that could be used in several places in the application.
What are the best practices for using the library in a web app - should I just be using
using (var service = new TemplateService())

wherever I want to use the templates? Will caching work if the template service is called like that? Or should I have a singleton somewhere?

Also, I've read that the previous version had support for pre-compiling the templates, I couldn't find the method Compile in Razor, so is it not in the new version yet? What's the difference between caching and pre-compiling anyway?

Thank you