ScriptContext
Assembly: ServiceStack.Common.dll
View Source
public class ScriptContext : IDisposable
Properties
PageFormats
View Source
public List<PageFormat> PageFormats { get; set; }
IndexPage
View Source
public string IndexPage { get; set; }
DefaultLayoutPage
View Source
public string DefaultLayoutPage { get; set; }
Pages
View Source
public ISharpPages Pages { get; set; }
VirtualFiles
View Source
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
public IVirtualFiles CacheFiles { get; set; }
Args
View Source
public Dictionary<string, object> Args { get; }
DebugMode
View Source
public bool DebugMode { get; set; }
ScanTypes
Scan Types and auto-register any Script Methods, Blocks and Code Pages
View Source
public List<Type> ScanTypes { get; set; }
ScanAssemblies
Scan Assemblies and auto-register any Script Methods, Blocks and Code Pages
View Source
public List<Assembly> ScanAssemblies { get; set; }
ScriptAssemblies
Allow scripting of Types from specified Assemblies
View Source
public List<Assembly> ScriptAssemblies { get; set; }
ScriptTypes
Allow scripting of the specified Types
View Source
public List<Type> ScriptTypes { get; set; }
ScriptNamespaces
Lookup Namespaces for resolving Types in Scripts
View Source
public List<string> ScriptNamespaces { get; set; }
AllowScriptingOfAllTypes
Allow scripting of all Types in loaded Assemblies
View Source
public bool AllowScriptingOfAllTypes { get; set; }
ScriptTypeNameMap
Register short Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)
View Source
public Dictionary<string, Type> ScriptTypeNameMap { get; }
ScriptTypeQualifiedNameMap
Register long qualified Type name accessible from scripts. (Advanced, use ScriptAssemblies/ScriptTypes first)
View Source
public Dictionary<string, Type> ScriptTypeQualifiedNameMap { get; }
Container
View Source
public IContainer Container { get; set; }
AppSettings
View Source
public IAppSettings AppSettings { get; set; }
Preprocessors
View Source
public List<Func<string, string>> Preprocessors { get; }
DefaultScriptLanguage
View Source
public ScriptLanguage DefaultScriptLanguage { get; set; }
ScriptLanguages
View Source
public List<ScriptLanguage> ScriptLanguages { get; }
ScriptMethods
View Source
public List<ScriptMethods> ScriptMethods { get; }
InsertScriptMethods
Insert additional Methods at the start so they have priority over default Script Methods
View Source
public List<ScriptMethods> InsertScriptMethods { get; }
ScriptBlocks
View Source
public List<ScriptBlock> ScriptBlocks { get; }
InsertScriptBlocks
Insert additional Blocks at the start so they have priority over default Script Blocks
View Source
public List<ScriptBlock> InsertScriptBlocks { get; }
CodePages
View Source
public Dictionary<string, Type> CodePages { get; }
ExcludeFiltersNamed
View Source
public HashSet<string> ExcludeFiltersNamed { get; }
Cache
View Source
public ConcurrentDictionary<string, object> Cache { get; }
CacheMemory
View Source
public ConcurrentDictionary<ReadOnlyMemory<char>, object> CacheMemory { get; }
ExpiringCache
View Source
public ConcurrentDictionary<string, Tuple<DateTime, object>> ExpiringCache { get; }
JsTokenCache
View Source
public ConcurrentDictionary<ReadOnlyMemory<char>, JsToken> JsTokenCache { get; }
AssignExpressionCache
View Source
public ConcurrentDictionary<string, Action<ScriptScopeContext, object, object>> AssignExpressionCache { get; }
CodePageInvokers
View Source
public ConcurrentDictionary<Type, Tuple<MethodInfo, MethodInvoker>> CodePageInvokers { get; }
PathMappings
View Source
public ConcurrentDictionary<string, string> PathMappings { get; }
Plugins
View Source
public List<IScriptPlugin> Plugins { get; }
InsertPlugins
Insert plugins at the start of Plugins so they're registered first
View Source
public List<IScriptPlugin> InsertPlugins { get; }
FileFilterNames
View Source
public HashSet<string> FileFilterNames { get; }
FilterTransformers
Available transformers that can transform context filter stream outputs
View Source
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
public bool CheckForModifiedPages { get; set; }
CheckForModifiedPagesAfter
How long in between checking for modified pages
View Source
public TimeSpan? CheckForModifiedPagesAfter { get; set; }
InvalidateCachesBefore
Existing caches and pages created prior to specified date should be invalidated
View Source
public DateTime? InvalidateCachesBefore { get; set; }
RenderExpressionExceptions
Render render filter exceptions in-line where filter is located
View Source
public bool RenderExpressionExceptions { get; set; }
AssignExceptionsTo
What argument to assign Exceptions to
View Source
public string AssignExceptionsTo { get; set; }
SkipExecutingFiltersIfError
Whether to skip executing expressions if an Exception was thrown
View Source
public bool SkipExecutingFiltersIfError { get; set; }
MaxQuota
Limit Max Iterations for Heavy Operations like rendering a Script Block (default 10K)
View Source
public int MaxQuota { get; set; }
MaxEvaluations
Limit Max number for micro ops like evaluating an AST instruction (default 1M)
View Source
public long MaxEvaluations { get; set; }
MaxStackDepth
Limit Recursion Max StackDepth (default 25)
View Source
public int MaxStackDepth { get; set; }
Log
View Source
public ILog Log { get; }
RemoveNewLineAfterFiltersNamed
View Source
public HashSet<string> RemoveNewLineAfterFiltersNamed { get; set; }
OnlyEvaluateFiltersWhenSkippingPageFilterExecution
View Source
public HashSet<string> OnlyEvaluateFiltersWhenSkippingPageFilterExecution { get; set; }
ParseAsLanguage
View Source
public Dictionary<string, ScriptLanguage> ParseAsLanguage { get; set; }
OnUnhandledExpression
View Source
public Func<PageVariableFragment, ReadOnlyMemory<byte>> OnUnhandledExpression { get; set; }
OnRenderException
View Source
public Action<PageResult, Exception> OnRenderException { get; set; }
DefaultMethods
View Source
public DefaultScripts DefaultMethods { get; }
ProtectedMethods
View Source
public ProtectedScripts ProtectedMethods { get; }
HtmlMethods
View Source
public HtmlScripts HtmlMethods { get; }
EmptyPage
View Source
public SharpPage EmptyPage { get; }
EmptyFile
View Source
public InMemoryVirtualFile EmptyFile { get; }
OnAfterPlugins
View Source
public Action<ScriptContext> OnAfterPlugins { get; set; }
HasInit
View Source
public bool HasInit { get; }
Methods
GetFormat(String)
View Source
public PageFormat GetFormat(string extension)
Returns
ServiceStack.Script.PageFormat
Parameters
Type | Name |
---|---|
System.String | extension |
GetScriptLanguage(String)
View Source
public ScriptLanguage GetScriptLanguage(string name)
Returns
ServiceStack.Script.ScriptLanguage
Parameters
Type | Name |
---|---|
System.String | name |
GetBlock(String)
View Source
public ScriptBlock GetBlock(string name)
Returns
ServiceStack.Script.ScriptBlock
Parameters
Type | Name |
---|---|
System.String | name |
GetPage(String)
View Source
public SharpPage GetPage(string virtualPath)
Returns
Parameters
Type | Name |
---|---|
System.String | virtualPath |
AssertProtectedMethods()
View Source
public ProtectedScripts AssertProtectedMethods()
Returns
ServiceStack.Script.ProtectedScripts
GetPage(String, String, out SharpPage, out SharpCodePage)
View Source
public void GetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Parameters
Type | Name |
---|---|
System.String | fromVirtualPath |
System.String | virtualPath |
ServiceStack.Script.SharpPage | page |
ServiceStack.Script.SharpCodePage | codePage |
TryGetPage(String, String, out SharpPage, out SharpCodePage)
View Source
public bool TryGetPage(string fromVirtualPath, string virtualPath, out SharpPage page, out SharpCodePage codePage)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | fromVirtualPath |
System.String | virtualPath |
ServiceStack.Script.SharpPage | page |
ServiceStack.Script.SharpCodePage | codePage |
OneTimePage(String, String)
View Source
public SharpPage OneTimePage(string contents, string ext = null)
Returns
Parameters
Type | Name |
---|---|
System.String | contents |
System.String | ext |
GetCodePage(String)
View Source
public SharpCodePage GetCodePage(string virtualPath)
Returns
ServiceStack.Script.SharpCodePage
Parameters
Type | Name |
---|---|
System.String | virtualPath |
SetPathMapping(String, String, String)
View Source
public string SetPathMapping(string prefix, string mapPath, string toPath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | mapPath |
System.String | toPath |
RemovePathMapping(String, String)
View Source
public void RemovePathMapping(string prefix, string mapPath)
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | mapPath |
GetPathMapping(String, String)
View Source
public string GetPathMapping(string prefix, string key)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | prefix |
System.String | key |
RemoveFilters(Predicate<ScriptMethods>)
View Source
public ScriptContext RemoveFilters(Predicate<ScriptMethods> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.ScriptMethods> | match |
RemoveBlocks(Predicate<ScriptBlock>)
View Source
public ScriptContext RemoveBlocks(Predicate<ScriptBlock> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.ScriptBlock> | match |
RemovePlugins(Predicate<IScriptPlugin>)
View Source
public ScriptContext RemovePlugins(Predicate<IScriptPlugin> match)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Predicate<ServiceStack.Script.IScriptPlugin> | match |
Init()
View Source
public ScriptContext Init()
Returns
ServiceStack.Script.ScriptContext
ScanType(Type)
View Source
public ScriptContext ScanType(Type type)
Returns
ServiceStack.Script.ScriptContext
Parameters
Type | Name |
---|---|
System.Type | type |
GetAssignExpression(Type, ReadOnlyMemory<Char>)
View Source
public Action<ScriptScopeContext, object, object> GetAssignExpression(Type targetType, ReadOnlyMemory<char> expression)
Returns
System.Action<ServiceStack.Script.ScriptScopeContext,System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Type | targetType |
ReadOnlyMemory<System.Char> | expression |
Dispose()
View Source
public void Dispose()
Implements
System.IDisposable