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
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageBlockFragment | block |
System.Threading.CancellationToken | token |
Inherited Methods
AssertWithinMaxQuota(Int32)
View Source
Declaration
protected int AssertWithinMaxQuota(int value)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.Int32 | value |
CanExportScopeArgs(Object)
View Source
Declaration
protected bool CanExportScopeArgs(object element)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Object | element |
Configure(ScriptContext)
View Source
Declaration
public void Configure(ScriptContext context)
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
GetCallTrace(PageBlockFragment)
View Source
Declaration
protected virtual string GetCallTrace(PageBlockFragment fragment)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.PageBlockFragment | fragment |
GetElseCallTrace(PageElseBlock)
View Source
Declaration
protected virtual string GetElseCallTrace(PageElseBlock fragment)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.PageElseBlock | fragment |
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
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.JsStatement[] | body |
System.String | callTrace |
System.Threading.CancellationToken | cancel |
WriteAsync(ScriptScopeContext, PageBlockFragment, CancellationToken)
View Source
Declaration
public abstract Task WriteAsync(ScriptScopeContext scope, PageBlockFragment block, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageBlockFragment | block |
System.Threading.CancellationToken | token |
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
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageFragment[] | body |
System.String | callTrace |
System.Threading.CancellationToken | cancel |
WriteBodyAsync(ScriptScopeContext, PageBlockFragment, CancellationToken)
View Source
Declaration
protected virtual async Task WriteBodyAsync(ScriptScopeContext scope, PageBlockFragment fragment, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageBlockFragment | fragment |
System.Threading.CancellationToken | token |
WriteElseAsync(ScriptScopeContext, PageElseBlock, CancellationToken)
View Source
Declaration
protected virtual async Task WriteElseAsync(ScriptScopeContext scope, PageElseBlock fragment, CancellationToken token)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageElseBlock | fragment |
System.Threading.CancellationToken | token |
WriteElseAsync(ScriptScopeContext, PageElseBlock[], CancellationToken)
View Source
Declaration
protected async Task WriteElseAsync(ScriptScopeContext scope, PageElseBlock[] elseBlocks, CancellationToken cancel)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.PageElseBlock[] | elseBlocks |
System.Threading.CancellationToken | cancel |