ScriptParser.ExecuteScriptAsync

Executes a script that supports {{ expression }} and {{% code block }} syntax and returns a string result. This version allows for async code inside of the template.

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> ExecuteScriptAsync(string script, object model, 
			CSharpScriptExecution scriptEngine, string basePath)

Parameters

script
The template to execute that contains C# script

model
A model that can be accessed in the template as Model. Model is exposed as dynamic which allows passing any value without requiring type dependencies at compile time.

         Pass null if you don't need to access values.

scriptEngine
Optional CSharpScriptEngine so you can customize configuration and capture result errors

basePath

Overloads