Some time ago rendering a template using RazorEngine
was as easy as:
string s = RazorEngine.Razor.Parse()
However, for some re
Building on @turdus-merula's answer, I wanted the temp files to be cleaned up when the default AppDomain is unloaded. I disabled the temp file locking in the config, which allows the temp folder to be deleted.
var config = new TemplateServiceConfiguration
{
TemplateManager = new ResolvePathTemplateManager(new[] {"EmailTemplates"}),
DisableTempFileLocking = true
};
Engine.Razor = RazorEngineService.Create(config);
var html = Engine.Razor.RunCompile("Test.cshtml", null, model);