ScriptParser.ExecuteScriptFileAsync
Executes a script that supports {{ expression }} and {{% code block }} syntax and returns a string result.
You can optionally pass in a pre-configured CSharpScriptExecution
instance
which allows setting references/namespaces and can capture error information.
Function returns null
on error and scriptEngine.Error
is set to true
along with the error message and the generated code.
public Task<string> ExecuteScriptFileAsync(string scriptFile, object model, CSharpScriptExecution scriptEngine, string basePath)
Parameters
scriptFile
model
A model that can be accessed in the template as Model
. Pass null if you don't need to access values.
scriptEngine
Optional CSharpScriptEngine so you can customize configuration and capture result errors
basePath