Razor |
public static class RazorCoreEngine
The RazorCoreEngine type exposes the following members.
| Name | Description | |
|---|---|---|
| CheckSyntax | Compile 'script' for a syntax check only: nothing is cached or persisted. A compilation failure throws the same TemplateCompilationException as Compile. On success, returns the compiler warnings located in the script and the generated C# code (to map RazorEngineCompilerError.Line). RazorEngineCore drops the diagnostics of a successful compilation, so the generated code is analyzed again with Roslyn (no emit). | |
| Compile | Compile 'script' under 'key' (no-op if already cached). When cacheDir is set, a persisted assembly is reused (and invalidated by lastModification), mirroring GetGlobalAssemblyCache/SaveAssemblyInCache. | |
| IsTemplateCached | Returns true if a compiled template is cached under the given key | |
| Run | Run the compiled template cached under 'key' with the given model and ViewBag, and return the rendered result |