我正在使用Razor引擎https://github.com/Antaris/RazorEngine来解析我的电子邮件模板的正文.是否可以定义布局并包含其他.cshtml文件?例如,公共页眉和页脚.
是否可以知道特定模板是否已使用 RazorEngine 编译?基本上,如果你打电话:
Razor.Parse("Hello there @Model.Name", model, "hello-world");
Run Code Online (Sandbox Code Playgroud)
这将使用键“hello-world”编译模板。第一次这可能需要几毫秒,但由于缓存,第二次几乎是即时的。是否可以知道模板是否已经编译?就像是:
var isCompiled = Razor.IsCompiled("Hello there @Model.Name", "hello-world");
Run Code Online (Sandbox Code Playgroud)