ScriptTemplateUtils
Assembly: ServiceStack.Common.dll
View Source
public static class ScriptTemplateUtils
Properties
BinderCache
View Source
public static ConcurrentDictionary<string, Func<ScriptScopeContext, object, object>> BinderCache { get; }
Methods
SharpScriptPage(ScriptContext, String)
Create SharpPage configured to use #Script
View Source
public static SharpPage SharpScriptPage(this ScriptContext context, string code)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | code |
TemplateSharpPage(ScriptContext, String)
Create SharpPage configured to use #Script Templates
View Source
public static SharpPage TemplateSharpPage(this ScriptContext context, string code)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | code |
RenderScript(ScriptContext, String, out ScriptException)
Render #Script output to string
View Source
public static string RenderScript(this ScriptContext context, string script, out ScriptException error)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
ServiceStack.Script.ScriptException | error |
EvaluateScript(ScriptContext, String, out ScriptException)
Alias for EvaluateScript
View Source
public static string EvaluateScript(this ScriptContext context, string script, out ScriptException error)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
ServiceStack.Script.ScriptException | error |
RenderScript(ScriptContext, String, Dictionary<String, Object>, out ScriptException)
Render #Script output to string
View Source
public static string RenderScript(this ScriptContext context, string script, Dictionary<string, object> args, out ScriptException error)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
ServiceStack.Script.ScriptException | error |
EvaluateScript(ScriptContext, String, Dictionary<String, Object>, out ScriptException)
Alias for RenderScript
View Source
public static string EvaluateScript(this ScriptContext context, string script, Dictionary<string, object> args, out ScriptException error)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
ServiceStack.Script.ScriptException | error |
RenderScript(ScriptContext, String, Dictionary<String, Object>)
Render #Script output to string
View Source
public static string RenderScript(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
EvaluateScript(ScriptContext, String, Dictionary<String, Object>)
Alias for RenderScript
View Source
public static string EvaluateScript(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
RenderScriptAsync(ScriptContext, String, Dictionary<String, Object>)
Render #Script output to string asynchronously
View Source
public static Task<string> RenderScriptAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
EvaluateScriptAsync(ScriptContext, String, Dictionary<String, Object>)
Alias for RenderScriptAsync
View Source
public static async Task<string> EvaluateScriptAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
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
public static T Evaluate<T>(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
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
public static object Evaluate(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
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
public static async Task<T> EvaluateAsync<T>(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
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
public static async Task<object> EvaluateAsync(this ScriptContext context, string script, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | script |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
ParseTemplate(String)
View Source
public static List<PageFragment> ParseTemplate(string text)
Returns
System.Collections.Generic.List<ServiceStack.Script.PageFragment>
Parameters
Type | Name |
---|---|
System.String | text |
ParseTemplateBody(ReadOnlyMemory<Char>, ReadOnlyMemory<Char>, out ReadOnlyMemory<Char>)
View Source
public static ReadOnlyMemory<char> ParseTemplateBody(this ReadOnlyMemory<char> literal, ReadOnlyMemory<char> blockName, out ReadOnlyMemory<char> body)
Returns
ReadOnlyMemory<System.Char>
Parameters
Type | Name |
---|---|
ReadOnlyMemory<System.Char> | literal |
ReadOnlyMemory<System.Char> | blockName |
ReadOnlyMemory<System.Char> | body |
ParseTemplateElseBlock(ReadOnlyMemory<Char>, String, out ReadOnlyMemory<Char>, out ReadOnlyMemory<Char>)
View Source
public static ReadOnlyMemory<char> ParseTemplateElseBlock(this ReadOnlyMemory<char> literal, string blockName, out ReadOnlyMemory<char> elseArgument, out ReadOnlyMemory<char> elseBody)
Returns
ReadOnlyMemory<System.Char>
Parameters
Type | Name |
---|---|
ReadOnlyMemory<System.Char> | literal |
System.String | blockName |
ReadOnlyMemory<System.Char> | elseArgument |
ReadOnlyMemory<System.Char> | elseBody |
ParseScript(ScriptContext, ReadOnlyMemory<Char>)
View Source
public static List<PageFragment> ParseScript(this ScriptContext context, ReadOnlyMemory<char> text)
Returns
System.Collections.Generic.List<ServiceStack.Script.PageFragment>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
ReadOnlyMemory<System.Char> | text |
ParseTemplate(ScriptContext, ReadOnlyMemory<Char>)
View Source
public static List<PageFragment> ParseTemplate(this ScriptContext context, ReadOnlyMemory<char> text)
Returns
System.Collections.Generic.List<ServiceStack.Script.PageFragment>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
ReadOnlyMemory<System.Char> | text |
ParseTemplateScriptBlock(ReadOnlyMemory<Char>, ScriptContext, out PageBlockFragment)
View Source
public static ReadOnlyMemory<char> ParseTemplateScriptBlock(this ReadOnlyMemory<char> literal, ScriptContext context, out PageBlockFragment blockFragment)
Returns
ReadOnlyMemory<System.Char>
Parameters
Type | Name |
---|---|
ReadOnlyMemory<System.Char> | literal |
ServiceStack.Script.ScriptContext | context |
ServiceStack.Script.PageBlockFragment | blockFragment |
ToRawString(String)
View Source
public static IRawString ToRawString(this string value)
Returns
Parameters
Type | Name |
---|---|
System.String | value |
GetMemberExpression(Type, ReadOnlyMemory<Char>)
View Source
public static Func<ScriptScopeContext, object, object> GetMemberExpression(Type targetType, ReadOnlyMemory<char> expression)
Returns
System.Func<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Type | targetType |
ReadOnlyMemory<System.Char> | expression |
Compile(Type, ReadOnlyMemory<Char>)
View Source
public static Func<ScriptScopeContext, object, object> Compile(Type type, ReadOnlyMemory<char> expr)
Returns
System.Func<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Type | type |
ReadOnlyMemory<System.Char> | expr |
CreateConvertMethod(Type)
View Source
public static MethodInfo CreateConvertMethod(Type toType)
Returns
System.Reflection.MethodInfo
Parameters
Type | Name |
---|---|
System.Type | toType |
CompileAssign(Type, ReadOnlyMemory<Char>)
View Source
public static Action<ScriptScopeContext, object, object> CompileAssign(Type type, ReadOnlyMemory<char> expr)
Returns
System.Action<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Type | type |
ReadOnlyMemory<System.Char> | expr |
EvaluateBinding(ScriptScopeContext, JsToken)
View Source
public static object EvaluateBinding(ScriptScopeContext scope, JsToken token)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.JsToken | token |
EvaluateBindingAs<T>(ScriptScopeContext, JsToken)
View Source
public static T EvaluateBindingAs<T>(ScriptScopeContext scope, JsToken token)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptScopeContext | scope |
ServiceStack.Script.JsToken | token |
Type Parameters
T
IsWhiteSpace(Char)
View Source
public static bool IsWhiteSpace(this char c)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Char | c |