Skip to main content

FunctionScriptBlock

Define a reusable function Usage: {{#function calc(a, b) }} a * b | to => c a + b + c | return {{/function}}

Assembly: ServiceStack.Common.dll
View Source
Declaration
public class FunctionScriptBlock : ScriptBlock, IConfigureScriptContext

Properties

Name

View Source
Declaration
public override string Name { get; }

Body

View Source
Declaration
public override ScriptLanguage Body { get; }

Inherited Properties

Body

Parse Body using Specified Language. Uses host language if unspecified.

View Source
Declaration
public virtual ScriptLanguage Body { get; }

Context

View Source
Declaration
public ScriptContext Context { get; set; }

Name

View Source
Declaration
public abstract string Name { get; }

Pages

View Source
Declaration
public ISharpPages Pages { get; set; }

Methods

WriteAsync(ScriptScopeContext, PageBlockFragment, CancellationToken)

View Source
Declaration
public override Task WriteAsync(ScriptScopeContext scope, PageBlockFragment block, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageBlockFragmentblock
System.Threading.CancellationTokentoken

Inherited Methods

AssertWithinMaxQuota(Int32)

View Source
Declaration
protected int AssertWithinMaxQuota(int value)
Returns

System.Int32

Parameters
TypeName
System.Int32value

CanExportScopeArgs(Object)

View Source
Declaration
protected bool CanExportScopeArgs(object element)
Returns

System.Boolean

Parameters
TypeName
System.Objectelement

Configure(ScriptContext)

View Source
Declaration
public void Configure(ScriptContext context)
Parameters
TypeName
ServiceStack.Script.ScriptContextcontext

GetCallTrace(PageBlockFragment)

View Source
Declaration
protected virtual string GetCallTrace(PageBlockFragment fragment)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.PageBlockFragmentfragment

GetElseCallTrace(PageElseBlock)

View Source
Declaration
protected virtual string GetElseCallTrace(PageElseBlock fragment)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.PageElseBlockfragment

WriteAsync(ScriptScopeContext, JsStatement[], String, CancellationToken)

View Source
Declaration
protected virtual async Task WriteAsync(ScriptScopeContext scope, JsStatement[] body, string callTrace, CancellationToken cancel)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.JsStatement[]body
System.StringcallTrace
System.Threading.CancellationTokencancel

WriteAsync(ScriptScopeContext, PageBlockFragment, CancellationToken)

View Source
Declaration
public abstract Task WriteAsync(ScriptScopeContext scope, PageBlockFragment block, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageBlockFragmentblock
System.Threading.CancellationTokentoken

WriteAsync(ScriptScopeContext, PageFragment[], String, CancellationToken)

View Source
Declaration
protected virtual async Task WriteAsync(ScriptScopeContext scope, PageFragment[] body, string callTrace, CancellationToken cancel)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageFragment[]body
System.StringcallTrace
System.Threading.CancellationTokencancel

WriteBodyAsync(ScriptScopeContext, PageBlockFragment, CancellationToken)

View Source
Declaration
protected virtual async Task WriteBodyAsync(ScriptScopeContext scope, PageBlockFragment fragment, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageBlockFragmentfragment
System.Threading.CancellationTokentoken

WriteElseAsync(ScriptScopeContext, PageElseBlock, CancellationToken)

View Source
Declaration
protected virtual async Task WriteElseAsync(ScriptScopeContext scope, PageElseBlock fragment, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageElseBlockfragment
System.Threading.CancellationTokentoken

WriteElseAsync(ScriptScopeContext, PageElseBlock[], CancellationToken)

View Source
Declaration
protected async Task WriteElseAsync(ScriptScopeContext scope, PageElseBlock[] elseBlocks, CancellationToken cancel)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.PageElseBlock[]elseBlocks
System.Threading.CancellationTokencancel

Implements