Skip to main content

ScriptContext

Assembly: ServiceStack.Common.dll​
View Source​
Declaration
public class ScriptContext : IDisposable

Properties​

PageFormats​

View Source​
Declaration
public List<PageFormat> PageFormats { get; set; }

IndexPage​

View Source​
Declaration
public string IndexPage { get; set; }

DefaultLayoutPage​

View Source​
Declaration
public string DefaultLayoutPage { get; set; }

Pages​

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

VirtualFiles​

View Source​
Declaration
public IVirtualPathProvider VirtualFiles { get; set; }

CacheFiles​

Where to store cached files, if unspecified falls back to configured VirtualFiles if it implements IVirtualFiles (i.e. writable)

View Source​
Declaration
public IVirtualFiles CacheFiles { get; set; }

Args​

View Source​
Declaration
public Dictionary<string, object> Args { get; }

DebugMode​

View Source​
Declaration
public bool DebugMode { get; set; }

ScanTypes​

Scan Types and auto-register any Script Methods, Blocks and Code Pages

View Source​
Declaration
public List<Type> ScanTypes { get; set; }

ScanAssemblies​

Scan Assemblies and auto-register any Script Methods, Blocks and Code Pages

View Source​
Declaration
public List<Assembly> ScanAssemblies { get; set; }

ScriptAssemblies​

Allow scripting of Types from specified Assemblies

View Source​
Declaration
public List<Assembly> ScriptAssemblies { get; set; }

ScriptTypes​

Allow scripting of the specified Types

View Source​
Declaration
public List<Type> ScriptTypes { get; set; }

ScriptNamespaces​

Lookup Namespaces for resolving Types in Scripts

View Source​
Declaration
public List<string> ScriptNamespaces { get; set; }

AllowScriptingOfAllTypes​

Allow scripting of all Types in loaded Assemblies

View Source​
Declaration
public bool AllowScriptingOfAllTypes { get; set; }

ScriptTypeNameMap​

Register short Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)

View Source​
Declaration
public Dictionary<string, Type> ScriptTypeNameMap { get; }

ScriptTypeQualifiedNameMap​

Register long qualified Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)

View Source​
Declaration
public Dictionary<string, Type> ScriptTypeQualifiedNameMap { get; }

Container​

View Source​
Declaration
public IContainer Container { get; set; }

AppSettings​

View Source​
Declaration
public IAppSettings AppSettings { get; set; }

Preprocessors​

View Source​
Declaration
public List<Func<string, string>> Preprocessors { get; }

DefaultScriptLanguage​

View Source​
Declaration
public ScriptLanguage DefaultScriptLanguage { get; set; }

ScriptLanguages​

View Source​
Declaration
public List<ScriptLanguage> ScriptLanguages { get; }

ScriptMethods​

View Source​
Declaration
public List<ScriptMethods> ScriptMethods { get; }

InsertScriptMethods​

Insert additional Methods at the start so they have priority over default Script Methods

View Source​
Declaration
public List<ScriptMethods> InsertScriptMethods { get; }

ScriptBlocks​

View Source​
Declaration
public List<ScriptBlock> ScriptBlocks { get; }

InsertScriptBlocks​

Insert additional Blocks at the start so they have priority over default Script Blocks

View Source​
Declaration
public List<ScriptBlock> InsertScriptBlocks { get; }

CodePages​

View Source​
Declaration
public Dictionary<string, Type> CodePages { get; }

ExcludeFiltersNamed​

View Source​
Declaration
public HashSet<string> ExcludeFiltersNamed { get; }

Cache​

View Source​
Declaration
public ConcurrentDictionary<string, object> Cache { get; }

CacheMemory​

View Source​
Declaration
public ConcurrentDictionary<ReadOnlyMemory<char>, object> CacheMemory { get; }

ExpiringCache​

View Source​
Declaration
public ConcurrentDictionary<string, Tuple<DateTime, object>> ExpiringCache { get; }

JsTokenCache​

View Source​
Declaration
public ConcurrentDictionary<ReadOnlyMemory<char>, JsToken> JsTokenCache { get; }

AssignExpressionCache​

View Source​
Declaration
public ConcurrentDictionary<string, Action<ScriptScopeContext, object, object>> AssignExpressionCache { get; }

CodePageInvokers​

View Source​
Declaration
public ConcurrentDictionary<Type, Tuple<MethodInfo, MethodInvoker>> CodePageInvokers { get; }

PathMappings​

View Source​
Declaration
public ConcurrentDictionary<string, string> PathMappings { get; }

Plugins​

View Source​
Declaration
public List<IScriptPlugin> Plugins { get; }

InsertPlugins​

Insert plugins at the start of Plugins so they're registered first

View Source​
Declaration
public List<IScriptPlugin> InsertPlugins { get; }

FileFilterNames​

View Source​
Declaration
public HashSet<string> FileFilterNames { get; }

FilterTransformers​

Available transformers that can transform context filter stream outputs

View Source​
Declaration
public Dictionary<string, Func<Stream, Task<Stream>>> FilterTransformers { get; set; }

CheckForModifiedPages​

Whether to check for modified pages by default when not in DebugMode

View Source​
Declaration
public bool CheckForModifiedPages { get; set; }

CheckForModifiedPagesAfter​

How long in between checking for modified pages

View Source​
Declaration
public TimeSpan? CheckForModifiedPagesAfter { get; set; }

InvalidateCachesBefore​

Existing caches and pages created prior to specified date should be invalidated

View Source​
Declaration
public DateTime? InvalidateCachesBefore { get; set; }

RenderExpressionExceptions​

Render render filter exceptions in-line where filter is located

View Source​
Declaration
public bool RenderExpressionExceptions { get; set; }

AssignExceptionsTo​

What argument to assign Exceptions to

View Source​
Declaration
public string AssignExceptionsTo { get; set; }

SkipExecutingFiltersIfError​

Whether to skip executing expressions if an Exception was thrown

View Source​
Declaration
public bool SkipExecutingFiltersIfError { get; set; }

MaxQuota​

Limit Max Iterations for Heavy Operations like rendering a Script Block (default 10K)

View Source​
Declaration
public int MaxQuota { get; set; }

MaxEvaluations​

Limit Max number for micro ops like evaluating an AST instruction (default 1M)

View Source​
Declaration
public long MaxEvaluations { get; set; }

MaxStackDepth​

Limit Recursion Max StackDepth (default 25)

View Source​
Declaration
public int MaxStackDepth { get; set; }

Log​

View Source​
Declaration
public ILog Log { get; }

RemoveNewLineAfterFiltersNamed​

View Source​
Declaration
public HashSet<string> RemoveNewLineAfterFiltersNamed { get; set; }

OnlyEvaluateFiltersWhenSkippingPageFilterExecution​

View Source​
Declaration
public HashSet<string> OnlyEvaluateFiltersWhenSkippingPageFilterExecution { get; set; }

ParseAsLanguage​

View Source​
Declaration
public Dictionary<string, ScriptLanguage> ParseAsLanguage { get; set; }

OnUnhandledExpression​

View Source​
Declaration
public Func<PageVariableFragment, ReadOnlyMemory<byte>> OnUnhandledExpression { get; set; }

OnRenderException​

View Source​
Declaration
public Action<PageResult, Exception> OnRenderException { get; set; }

DefaultMethods​

View Source​
Declaration
public DefaultScripts DefaultMethods { get; }

ProtectedMethods​

View Source​
Declaration
public ProtectedScripts ProtectedMethods { get; }

HtmlMethods​

View Source​
Declaration
public HtmlScripts HtmlMethods { get; }

EmptyPage​

View Source​
Declaration
public SharpPage EmptyPage { get; }

EmptyFile​

View Source​
Declaration
public InMemoryVirtualFile EmptyFile { get; }

OnAfterPlugins​

View Source​
Declaration
public Action<ScriptContext> OnAfterPlugins { get; set; }

HasInit​

View Source​
Declaration
public bool HasInit { get; }

Methods​

GetFormat(String)​

View Source​
Declaration
public PageFormat GetFormat(string extension)
Returns​

ServiceStack.Script.PageFormat

Parameters​
TypeName
System.Stringextension

GetScriptLanguage(String)​

View Source​
Declaration
public ScriptLanguage GetScriptLanguage(string name)
Returns​

ServiceStack.Script.ScriptLanguage

Parameters​
TypeName
System.Stringname

GetBlock(String)​

View Source​
Declaration
public ScriptBlock GetBlock(string name)
Returns​

ServiceStack.Script.ScriptBlock

Parameters​
TypeName
System.Stringname

GetPage(String)​

View Source​
Declaration
public SharpPage GetPage(string virtualPath)
Returns​

ServiceStack.Script.SharpPage

Parameters​
TypeName
System.StringvirtualPath

AssertProtectedMethods()​

View Source​
Declaration
public ProtectedScripts AssertProtectedMethods()
Returns​

ServiceStack.Script.ProtectedScripts

GetPage(String, String, out SharpPage, out SharpCodePage)​

View Source​
Declaration
public void GetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Parameters​
TypeName
System.StringfromVirtualPath
System.StringvirtualPath
ServiceStack.Script.SharpPagepage
ServiceStack.Script.SharpCodePagecodePage

TryGetPage(String, String, out SharpPage, out SharpCodePage)​

View Source​
Declaration
public bool TryGetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Returns​

System.Boolean

Parameters​
TypeName
System.StringfromVirtualPath
System.StringvirtualPath
ServiceStack.Script.SharpPagepage
ServiceStack.Script.SharpCodePagecodePage

OneTimePage(String, String)​

View Source​
Declaration
public SharpPage OneTimePage(string contents, string ext = null)
Returns​

ServiceStack.Script.SharpPage

Parameters​
TypeName
System.Stringcontents
System.Stringext

GetCodePage(String)​

View Source​
Declaration
public SharpCodePage GetCodePage(string virtualPath)
Returns​

ServiceStack.Script.SharpCodePage

Parameters​
TypeName
System.StringvirtualPath

SetPathMapping(String, String, String)​

View Source​
Declaration
public string SetPathMapping(string prefix, string mapPath, string toPath)
Returns​

System.String

Parameters​
TypeName
System.Stringprefix
System.StringmapPath
System.StringtoPath

RemovePathMapping(String, String)​

View Source​
Declaration
public void RemovePathMapping(string prefix, string mapPath)
Parameters​
TypeName
System.Stringprefix
System.StringmapPath

GetPathMapping(String, String)​

View Source​
Declaration
public string GetPathMapping(string prefix, string key)
Returns​

System.String

Parameters​
TypeName
System.Stringprefix
System.Stringkey

RemoveFilters(Predicate<ScriptMethods>)​

View Source​
Declaration
public ScriptContext RemoveFilters(Predicate<ScriptMethods> match)
Returns​

ServiceStack.Script.ScriptContext

Parameters​
TypeName
System.Predicate<ServiceStack.Script.ScriptMethods>match

RemoveBlocks(Predicate<ScriptBlock>)​

View Source​
Declaration
public ScriptContext RemoveBlocks(Predicate<ScriptBlock> match)
Returns​

ServiceStack.Script.ScriptContext

Parameters​
TypeName
System.Predicate<ServiceStack.Script.ScriptBlock>match

RemovePlugins(Predicate<IScriptPlugin>)​

View Source​
Declaration
public ScriptContext RemovePlugins(Predicate<IScriptPlugin> match)
Returns​

ServiceStack.Script.ScriptContext

Parameters​
TypeName
System.Predicate<ServiceStack.Script.IScriptPlugin>match

Init()​

View Source​
Declaration
public ScriptContext Init()
Returns​

ServiceStack.Script.ScriptContext

ScanType(Type)​

View Source​
Declaration
public ScriptContext ScanType(Type type)
Returns​

ServiceStack.Script.ScriptContext

Parameters​
TypeName
System.Typetype

GetAssignExpression(Type, ReadOnlyMemory<Char>)​

View Source​
Declaration
public Action<ScriptScopeContext, object, object> GetAssignExpression(Type targetType, ReadOnlyMemory<char> expression)
Returns​

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

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

Dispose()​

View Source​
Declaration
public void Dispose()

Implements​

  • System.IDisposable