Skip to main content

ScriptTemplateUtils

Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class ScriptTemplateUtils

Properties

BinderCache

View Source
Declaration
public static ConcurrentDictionary<string, Func<ScriptScopeContext, object, object>> BinderCache { get; }

Methods

SharpScriptPage(ScriptContext, String)

Create SharpPage configured to use #Script

View Source
Declaration
public static SharpPage SharpScriptPage(this ScriptContext context, string code)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringcode

TemplateSharpPage(ScriptContext, String)

Create SharpPage configured to use #Script Templates

View Source
Declaration
public static SharpPage TemplateSharpPage(this ScriptContext context, string code)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringcode

RenderScript(ScriptContext, String, out ScriptException)

Render #Script output to string

View Source
Declaration
public static string RenderScript(this ScriptContext context, string script, out ScriptException error)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
ServiceStack.Script.ScriptExceptionerror

EvaluateScript(ScriptContext, String, out ScriptException)

Alias for EvaluateScript

View Source
Declaration
public static string EvaluateScript(this ScriptContext context, string script, out ScriptException error)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
ServiceStack.Script.ScriptExceptionerror

RenderScript(ScriptContext, String, Dictionary<String, Object>, out ScriptException)

Render #Script output to string

View Source
Declaration
public static string RenderScript(this ScriptContext context, string script, Dictionary<string, object> args, out ScriptException error)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args
ServiceStack.Script.ScriptExceptionerror

EvaluateScript(ScriptContext, String, Dictionary<String, Object>, out ScriptException)

Alias for RenderScript

View Source
Declaration
public static string EvaluateScript(this ScriptContext context, string script, Dictionary<string, object> args, out ScriptException error)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args
ServiceStack.Script.ScriptExceptionerror

RenderScript(ScriptContext, String, Dictionary<String, Object>)

Render #Script output to string

View Source
Declaration
public static string RenderScript(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvaluateScript(ScriptContext, String, Dictionary<String, Object>)

Alias for RenderScript

View Source
Declaration
public static string EvaluateScript(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

RenderScriptAsync(ScriptContext, String, Dictionary<String, Object>)

Render #Script output to string asynchronously

View Source
Declaration
public static Task<string> RenderScriptAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<System.String>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvaluateScriptAsync(ScriptContext, String, Dictionary<String, Object>)

Alias for RenderScriptAsync

View Source
Declaration
public static async Task<string> EvaluateScriptAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<System.String>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

Evaluate<T>(ScriptContext, String, Dictionary<String, Object>)

Evaluate #Script and convert returned value to T

View Source
Declaration
public static T Evaluate<T>(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

<T>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args
Type Parameters
  • T

Evaluate(ScriptContext, String, Dictionary<String, Object>)

Evaluate #Script and return value

View Source
Declaration
public static object Evaluate(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.Object

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvaluateAsync<T>(ScriptContext, String, Dictionary<String, Object>)

Evaluate #Script and convert returned value to T asynchronously

View Source
Declaration
public static async Task<T> EvaluateAsync<T>(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<<T>>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args
Type Parameters
  • T

EvaluateAsync(ScriptContext, String, Dictionary<String, Object>)

Evaluate #Script and convert returned value to T asynchronously

View Source
Declaration
public static async Task<object> EvaluateAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringscript
System.Collections.Generic.Dictionary<System.String,System.Object>args

ParseTemplate(String)

View Source
Declaration
public static List<PageFragment> ParseTemplate(string text)
Returns

System.Collections.Generic.List<ServiceStack.Script.PageFragment>

Parameters
TypeName
System.Stringtext

ParseTemplateBody(ReadOnlyMemory<Char>, ReadOnlyMemory<Char>, out ReadOnlyMemory<Char>)

View Source
Declaration
public static ReadOnlyMemory<char> ParseTemplateBody(this ReadOnlyMemory<char> literal, ReadOnlyMemory<char> blockName, out ReadOnlyMemory<char> body)
Returns

ReadOnlyMemory<System.Char>

Parameters
TypeName
ReadOnlyMemory<System.Char>literal
ReadOnlyMemory<System.Char>blockName
ReadOnlyMemory<System.Char>body

ParseTemplateElseBlock(ReadOnlyMemory<Char>, String, out ReadOnlyMemory<Char>, out ReadOnlyMemory<Char>)

View Source
Declaration
public static ReadOnlyMemory<char> ParseTemplateElseBlock(this ReadOnlyMemory<char> literal, string blockName, out ReadOnlyMemory<char> elseArgument, out ReadOnlyMemory<char> elseBody)
Returns

ReadOnlyMemory<System.Char>

Parameters
TypeName
ReadOnlyMemory<System.Char>literal
System.StringblockName
ReadOnlyMemory<System.Char>elseArgument
ReadOnlyMemory<System.Char>elseBody

ParseScript(ScriptContext, ReadOnlyMemory<Char>)

View Source
Declaration
public static List<PageFragment> ParseScript(this ScriptContext context, ReadOnlyMemory<char> text)
Returns

System.Collections.Generic.List<ServiceStack.Script.PageFragment>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
ReadOnlyMemory<System.Char>text

ParseTemplate(ScriptContext, ReadOnlyMemory<Char>)

View Source
Declaration
public static List<PageFragment> ParseTemplate(this ScriptContext context, ReadOnlyMemory<char> text)
Returns

System.Collections.Generic.List<ServiceStack.Script.PageFragment>

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
ReadOnlyMemory<System.Char>text

ParseTemplateScriptBlock(ReadOnlyMemory<Char>, ScriptContext, out PageBlockFragment)

View Source
Declaration
public static ReadOnlyMemory<char> ParseTemplateScriptBlock(this ReadOnlyMemory<char> literal, ScriptContext context, out PageBlockFragment blockFragment)
Returns

ReadOnlyMemory<System.Char>

Parameters
TypeName
ReadOnlyMemory<System.Char>literal
ServiceStack.Script.ScriptContextcontext
ServiceStack.Script.PageBlockFragmentblockFragment

ToRawString(String)

View Source
Declaration
public static IRawString ToRawString(this string value)
Returns

ServiceStack.IRawString

Parameters
TypeName
System.Stringvalue

GetMemberExpression(Type, ReadOnlyMemory<Char>)

View Source
Declaration
public static Func<ScriptScopeContext, object, object> GetMemberExpression(Type targetType, ReadOnlyMemory<char> expression)
Returns

System.Func<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>

Parameters
TypeName
System.TypetargetType
ReadOnlyMemory<System.Char>expression

Compile(Type, ReadOnlyMemory<Char>)

View Source
Declaration
public static Func<ScriptScopeContext, object, object> Compile(Type type, ReadOnlyMemory<char> expr)
Returns

System.Func<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>

Parameters
TypeName
System.Typetype
ReadOnlyMemory<System.Char>expr

CreateConvertMethod(Type)

View Source
Declaration
public static MethodInfo CreateConvertMethod(Type toType)
Returns

System.Reflection.MethodInfo

Parameters
TypeName
System.TypetoType

CompileAssign(Type, ReadOnlyMemory<Char>)

View Source
Declaration
public static Action<ScriptScopeContext, object, object> CompileAssign(Type type, ReadOnlyMemory<char> expr)
Returns

System.Action<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>

Parameters
TypeName
System.Typetype
ReadOnlyMemory<System.Char>expr

EvaluateBinding(ScriptScopeContext, JsToken)

View Source
Declaration
public static object EvaluateBinding(ScriptScopeContext scope, JsToken token)
Returns

System.Object

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.JsTokentoken

EvaluateBindingAs<T>(ScriptScopeContext, JsToken)

View Source
Declaration
public static T EvaluateBindingAs<T>(ScriptScopeContext scope, JsToken token)
Returns

<T>

Parameters
TypeName
ServiceStack.Script.ScriptScopeContextscope
ServiceStack.Script.JsTokentoken
Type Parameters
  • T

IsWhiteSpace(Char)

View Source
Declaration
public static bool IsWhiteSpace(this char c)
Returns

System.Boolean

Parameters
TypeName
System.Charc