C# Class Sage.SageContext

Provides the working environment for code within Sage.
Inheritance: IXmlConvertible
Show file Open project: igorfrance/sage Class Usage Examples

Public Methods

Method Description
ExpandUrl ( string path ) : string

Returns an absolute URL, fully expanded to a path within the current application.

GetProjectVariable ( string name, string locale = null ) : string

Gets the value of the project variable with the specified name.

MapPath ( string path ) : string

Maps the supplied relative path to the actual, physical location of the file.

If the specified path is an absolute path, no translation will be done.

Parse ( XmlElement element ) : void
ProcessNode ( XmlNode node ) : XmlNode

Recursively processes all nodes in the specified node, applying any registered text and node handlers on the way, and returns the result.

ProcessText ( string text ) : string

Replaces any function or variable expression with the result of invoking it's corresponding handler function.

SageContext ( ControllerContext controllerContext, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified ControllerContext.

SageContext ( HttpContext httpContext, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified HttpContext.

SageContext ( System.Web.HttpContextBase httpContext, string>.Func pathMapper, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified HttpContextBase and pathMapper.

SageContext ( System.Web.HttpContextBase httpContext, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified HttpContextBase.

SageContext ( System.Web.HttpContextBase httpContext, string categoryName, string>.Func pathMapper, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified httpContext, categoryName and pathMapper.

SageContext ( System.Web.HttpContextBase httpContext, string categoryName, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified httpContext and categoryName.

SageContext ( System.Web.HttpContextBase httpContext, string categoryName, string localeName, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using the specified httpContext and categoryName.

SageContext ( SageContext context, ProjectConfiguration config = null, string>.Func pathMapper = null ) : System

Initializes a new instance of the SageContext class, using an existing context instance.

SageContext ( SageContext context, string categoryName, ProjectConfiguration config = null ) : System

Initializes a new instance of the SageContext class, using an existing context instance.

ToXml ( XmlDocument ownerDocument ) : XmlElement

Gets an XmlElement that contains information about this context.

Private Methods

Method Description
Copy ( ) : SageContext

Returns a copy of this instance.

Copy ( string category ) : SageContext

Returns a copy of this instance, setting its category to the specified category.

Copy ( string category, string locale ) : SageContext

Returns a copy of this instance, setting its category and locale to the specified values.

CreateAddressNode ( Uri uri, XmlDocument ownerDocument, string nodeName = "sage:address" ) : XmlElement
GetContextProperty ( SageContext context, string propName, string propKey ) : string
GetDataParam ( SageContext context ) : string
GetFormParam ( SageContext context ) : string
GetQueryParam ( SageContext context ) : string
GetRequestParam ( SageContext context ) : string
GetSessionParam ( SageContext context ) : string
GetVariable ( SageContext context ) : string
IIf ( SageContext context ) : string
IsNull ( SageContext context ) : string
ProcessBaseHrefNode ( SageContext context, XmlNode node ) : XmlNode
ProcessContextIfNode ( SageContext context, XmlNode node ) : XmlNode
ProcessContextSwitchNode ( SageContext context, XmlNode switchNode ) : XmlNode
ProcessContextValueNode ( SageContext context, XmlNode node ) : XmlNode
ProcessSageVersionNode ( SageContext context, XmlNode node ) : XmlNode
ResolvePathVariable ( SageContext context, string variable ) : string
SubstituteExtensionPath ( ) : bool

Method Details

ExpandUrl() public method

Returns an absolute URL, fully expanded to a path within the current application.
/// If the argument is empty or a null. ///
public ExpandUrl ( string path ) : string
path string The path to expand
return string

GetProjectVariable() public method

Gets the value of the project variable with the specified name.
public GetProjectVariable ( string name, string locale = null ) : string
name string The name of the variable.
locale string Optional locale to use to select the variable value. If omitted the current will be used
return string

MapPath() public method

Maps the supplied relative path to the actual, physical location of the file.
If the specified path is an absolute path, no translation will be done.
/// is null or empty. ///
public MapPath ( string path ) : string
path string The path to map
return string

Parse() public method

public Parse ( XmlElement element ) : void
element System.Xml.XmlElement
return void

ProcessNode() public method

Recursively processes all nodes in the specified node, applying any registered text and node handlers on the way, and returns the result.
public ProcessNode ( XmlNode node ) : XmlNode
node System.Xml.XmlNode The node to process.
return System.Xml.XmlNode

ProcessText() public method

Replaces any function or variable expression with the result of invoking it's corresponding handler function.
public ProcessText ( string text ) : string
text string The text to process.
return string

SageContext() public method

Initializes a new instance of the SageContext class, using the specified ControllerContext.
public SageContext ( ControllerContext controllerContext, ProjectConfiguration config = null ) : System
controllerContext ControllerContext The current to use to initialize this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified HttpContext.
public SageContext ( HttpContext httpContext, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContext The current to use to initialize this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified HttpContextBase and pathMapper.
public SageContext ( System.Web.HttpContextBase httpContext, string>.Func pathMapper, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContextBase The current to use to initialize this instance.
pathMapper string>.Func The function to use for resolving relative paths.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified HttpContextBase.
public SageContext ( System.Web.HttpContextBase httpContext, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContextBase The current to use to initialize this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified httpContext, categoryName and pathMapper.
public SageContext ( System.Web.HttpContextBase httpContext, string categoryName, string>.Func pathMapper, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContextBase The current HTTP context.
categoryName string The category to set for this instance.
pathMapper string>.Func The function to use to map relative paths to absolute.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified httpContext and categoryName.
public SageContext ( System.Web.HttpContextBase httpContext, string categoryName, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContextBase The current HTTP context.
categoryName string The category to set for this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using the specified httpContext and categoryName.
public SageContext ( System.Web.HttpContextBase httpContext, string categoryName, string localeName, ProjectConfiguration config = null ) : System
httpContext System.Web.HttpContextBase The current HTTP context.
categoryName string The category to set for this instance.
localeName string The locale to set for this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using an existing context instance.
public SageContext ( SageContext context, ProjectConfiguration config = null, string>.Func pathMapper = null ) : System
context SageContext An existing to use to initialize this instance.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
pathMapper string>.Func The function to use for resolving relative paths.
return System

SageContext() public method

Initializes a new instance of the SageContext class, using an existing context instance.
public SageContext ( SageContext context, string categoryName, ProjectConfiguration config = null ) : System
context SageContext An existing to use to initialize this instance.
categoryName string The name of the category to set on the new context.
config Sage.Configuration.ProjectConfiguration The project configuration to use with this context instance.
return System

ToXml() public method

Gets an XmlElement that contains information about this context.
/// is null. ///
public ToXml ( XmlDocument ownerDocument ) : XmlElement
ownerDocument System.Xml.XmlDocument The to use to create the element.
return System.Xml.XmlElement