Skip to main content

SharpPagesFeature

Assembly: ServiceStack.dll
View Source
Declaration
public class SharpPagesFeature : ScriptContext, IDisposable, IPlugin, IViewEngine, IHasStringId, IHasId<string>

Properties

Id

View Source
Declaration
public string Id { get; set; }

EnableHotReload

View Source
Declaration
public bool? EnableHotReload { get; set; }

EnableSpaFallback

View Source
Declaration
public bool? EnableSpaFallback { get; set; }

DisablePageBasedRouting

View Source
Declaration
public bool DisablePageBasedRouting { get; set; }

DebugDefaultTemplate

View Source
Declaration
public string DebugDefaultTemplate { get; set; }

ApiPath

View Source
Declaration
public string ApiPath { get; set; }

ApiDefaultContentType

View Source
Declaration
public string ApiDefaultContentType { get; set; }

ScriptAdminRole

Role Required to call Templates Admin Service (/script/admin), Default is Admin. If null Templates Admin Service will not be registered.

View Source
Declaration
public string ScriptAdminRole { get; set; }

MetadataDebugAdminRole

Role Required to call Metadata Debug Service (/metadata/debug). If null Metadata Debug Service will only be registered in DebugMode.

View Source
Declaration
public string MetadataDebugAdminRole { get; set; }

IgnorePaths

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

ServiceStackScripts

View Source
Declaration
public ServiceStackScripts ServiceStackScripts { get; }

HtmlExtension

View Source
Declaration
public string HtmlExtension { get; set; }

ExcludeProtectedFilters

View Source
Declaration
public bool ExcludeProtectedFilters { set; }

ImportRequestParams

Whether to auto populate scoped args with Request.FormData[] and Request.QueryString[] params (default false). Recommendation is to instead use form.name or query.name (or qs.name) to explicitly reference user input values.

View Source
Declaration
public bool ImportRequestParams { get; set; }

Inherited Properties

AllowScriptingOfAllTypes

Allow scripting of all Types in loaded Assemblies

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

AppSettings

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

Args

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

AssignExceptionsTo

What argument to assign Exceptions to

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

AssignExpressionCache

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

Cache

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

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; }

CacheMemory

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

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; }

CodePageInvokers

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

CodePages

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

Container

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

DebugMode

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

DefaultLayoutPage

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

DefaultMethods

View Source
Declaration
public DefaultScripts DefaultMethods { get; }

DefaultScriptLanguage

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

EmptyFile

View Source
Declaration
public InMemoryVirtualFile EmptyFile { get; }

EmptyPage

View Source
Declaration
public SharpPage EmptyPage { get; }

ExcludeFiltersNamed

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

ExpiringCache

View Source
Declaration
public ConcurrentDictionary<string, Tuple<DateTime, object>> ExpiringCache { 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; }

HasInit

View Source
Declaration
public bool HasInit { get; }

HtmlMethods

View Source
Declaration
public HtmlScripts HtmlMethods { get; }

IndexPage

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

InsertPlugins

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

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

InsertScriptBlocks

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

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

InsertScriptMethods

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

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

InvalidateCachesBefore

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

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

JsTokenCache

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

Log

View Source
Declaration
public ILog Log { get; }

MaxEvaluations

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

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

MaxQuota

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

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

MaxStackDepth

Limit Recursion Max StackDepth (default 25)

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

OnAfterPlugins

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

OnlyEvaluateFiltersWhenSkippingPageFilterExecution

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

OnRenderException

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

OnUnhandledExpression

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

PageFormats

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

Pages

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

ParseAsLanguage

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

PathMappings

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

Plugins

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

Preprocessors

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

ProtectedMethods

View Source
Declaration
public ProtectedScripts ProtectedMethods { get; }

RemoveNewLineAfterFiltersNamed

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

RenderExpressionExceptions

Render render filter exceptions in-line where filter is located

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

ScanAssemblies

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

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

ScanTypes

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

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

ScriptAssemblies

Allow scripting of Types from specified Assemblies

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

ScriptBlocks

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

ScriptLanguages

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

ScriptMethods

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

ScriptNamespaces

Lookup Namespaces for resolving Types in Scripts

View Source
Declaration
public List<string> ScriptNamespaces { 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; }

ScriptTypes

Allow scripting of the specified Types

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

SkipExecutingFiltersIfError

Whether to skip executing expressions if an Exception was thrown

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

VirtualFiles

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

Methods

Register(IAppHost)

View Source
Declaration
public virtual void Register(IAppHost appHost)
Parameters
TypeName
ServiceStack.IAppHostappHost

RunInitPage()

View Source
Declaration
public string RunInitPage()
Returns

System.String

RequestHandler(String, String, String)

View Source
Declaration
protected virtual IHttpHandler RequestHandler(string httpMethod, string pathInfo, string filePath)
Returns

System.Web.IHttpHandler

Parameters
TypeName
System.StringhttpMethod
System.StringpathInfo
System.StringfilePath

PageBasedRoutingHandler(String, String, String)

View Source
Declaration
protected virtual IHttpHandler PageBasedRoutingHandler(string httpMethod, string pathInfo, string requestFilePath)
Returns

System.Web.IHttpHandler

Parameters
TypeName
System.StringhttpMethod
System.StringpathInfo
System.StringrequestFilePath

GetRoutingPage(String, out Dictionary<String, Object>)

Resolve Page-based Routing page from /path/info

View Source
Declaration
public SharpPage GetRoutingPage(string pathInfo, out Dictionary<string, object> routingArgs)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
System.StringpathInfo
System.Collections.Generic.Dictionary<System.String,System.Object>routingArgs

GetViewPage(String)

View Source
Declaration
public SharpPage GetViewPage(string viewName)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
System.StringviewName

HasView(String, IRequest)

View Source
Declaration
public bool HasView(string viewName, IRequest httpReq = null)
Returns

System.Boolean

Parameters
TypeName
System.StringviewName
ServiceStack.Web.IRequesthttpReq

RenderPartial(String, Object, Boolean, StreamWriter, IHtmlContext)

View Source
Declaration
public string RenderPartial(string pageName, object model, bool renderHtml, StreamWriter writer = null, IHtmlContext htmlHelper = null)
Returns

System.String

Parameters
TypeName
System.StringpageName
System.Objectmodel
System.BooleanrenderHtml
System.IO.StreamWriterwriter
ServiceStack.Html.IHtmlContexthtmlHelper

ProcessRequestAsync(IRequest, Object, Stream)

View Source
Declaration
public async Task<bool> ProcessRequestAsync(IRequest req, object dto, Stream outputStream)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Objectdto
System.IO.StreamoutputStream

Inherited Methods

AssertProtectedMethods()

View Source
Declaration
public ProtectedScripts AssertProtectedMethods()
Returns

ServiceStack.Script.ProtectedScripts

Dispose()

View Source
Declaration
public void Dispose()

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

GetBlock(String)

View Source
Declaration
public ScriptBlock GetBlock(string name)
Returns

ServiceStack.Script.ScriptBlock

Parameters
TypeName
System.Stringname

GetCodePage(String)

View Source
Declaration
public SharpCodePage GetCodePage(string virtualPath)
Returns

ServiceStack.Script.SharpCodePage

Parameters
TypeName
System.StringvirtualPath

GetFormat(String)

View Source
Declaration
public PageFormat GetFormat(string extension)
Returns

ServiceStack.Script.PageFormat

Parameters
TypeName
System.Stringextension

GetPage(String)

View Source
Declaration
public SharpPage GetPage(string virtualPath)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
System.StringvirtualPath

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

GetPathMapping(String, String)

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

System.String

Parameters
TypeName
System.Stringprefix
System.Stringkey

GetScriptLanguage(String)

View Source
Declaration
public ScriptLanguage GetScriptLanguage(string name)
Returns

ServiceStack.Script.ScriptLanguage

Parameters
TypeName
System.Stringname

Init()

View Source
Declaration
public ScriptContext Init()
Returns

ServiceStack.Script.ScriptContext

OneTimePage(String, String)

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

ServiceStack.Script.SharpPage

Parameters
TypeName
System.Stringcontents
System.Stringext

RemoveBlocks(Predicate<ScriptBlock>)

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

ServiceStack.Script.ScriptContext

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

RemoveFilters(Predicate<ScriptMethods>)

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

ServiceStack.Script.ScriptContext

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

RemovePathMapping(String, String)

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

RemovePlugins(Predicate<IScriptPlugin>)

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

ServiceStack.Script.ScriptContext

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

ScanType(Type)

View Source
Declaration
public ScriptContext ScanType(Type type)
Returns

ServiceStack.Script.ScriptContext

Parameters
TypeName
System.Typetype

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

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

Implements