Vla*_*nko 3 asp.net razorengine
我的 RazorEngine 版本 3.6.3 有问题 RazorEngine 无法从“字符串”转换为“RazorEngine.Template.ITemplateKey”
我的代码如下:
var templateServiceConfiguration = new TemplateServiceConfiguration();
templateServiceConfiguration.Namespaces.Add("System.Configuration");
var body = string.Empty;
using (var service = RazorEngineService.Create(templateServiceConfiguration))
{
body = service.RunCompile(emailTemplate.Body, emailTemplate.UniqueName, model: _model, modelType: null, viewBag: null);
}
Run Code Online (Sandbox Code Playgroud)
所以这个方法 service.RunCompile( 作为第一个参数 ITemplateKey ,但是这个方法也有重载必须支持我的版本。
请帮忙。
这碰巧使我能够解决我不同但相似的问题。谢谢!
除了使用 Engine.Razor.RunCompile 时,我得到了基本相同的错误消息,如下所示:
Engine.Razor.RunCompile("templateid", templateHtml, null, new { Name = "World" });
Run Code Online (Sandbox Code Playgroud)
文档规定您必须仅包含 RazorEngine.Templated 命名空间,而我需要同时包含 RazorEngine 和 RazorEngine.Templated。
using RazorEngine;
using RazorEngine.Templating;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1562 次 |
| 最近记录: |