C# Class Sage.Controllers.SageController

Provides a base class for all controllers within the application.
Inheritance: Controller, IModuleFactory
ファイルを表示 Open project: igorfrance/sage Class Usage Examples

Private Properties

Property Type Description
DiscoverViewXmlFilters void
InitializeForTesting void
OnAssembliesUpdated void
SageController System

Public Methods

Method Description
CreateModule ( XmlElement moduleElement ) : IModule
GetLastModificationDate ( string viewName ) : DateTime?

Gets the last modification date for the specified viewName.

Each action can and should be cached by the browsers. When subsequent requests come in, browsers will send the last modification date that they received the last time they got that file, in order for the server to figure out whether to send a new version. With sage controllers views, the last modification date is actually the latest modification date of possibly a whole series of files. Those files could be the XSLT style-sheet itself or any one of its includes, or the XML configuration file or any one of its includes. Therefore it is necessary to have this extra piece of logic to effectively determine what that latest modification date is.

GetViewInfo ( string viewName ) : ViewInfo

Gets the view info corresponding to this controller and the specified viewName.

GetViewModel ( ViewInfo viewInfo ) : ViewModel

Processes the view configuration associated with the specified viewInfo, and returns a ViewModel instance that contains the result.

GetViewModel ( string viewName ) : ViewModel

Processes the view configuration associated with the specified viewName, and returns a ViewModel instance that contains the result.

PageNotFound ( string action = null ) : System.Web.Mvc.ActionResult

Sets the HTTP status to not found (404) and returns an EmptyResult.

PrepareViewXml ( System.Web.Mvc.ViewContext viewContext ) : XmlDocument

Wraps the previously processed view configuration input XML with the standard XML envelope that contains information about the current request, and the resources referenced by the modules and libraries in use by the the view.

SageView ( ViewInfo viewInfo ) : System.Web.Mvc.ActionResult

Processes the view descibed with the specified viewInfo, and returns an ActionResult.

SageView ( string viewName ) : System.Web.Mvc.ActionResult

Processes the view configuration associated with the specified viewName, and returns an ActionResult.

Protected Methods

Method Description
AddMessage ( MessageType type, string messageText ) : void

Adds a message to this controller's message collection

AddMessagePhrase ( MessageType type, string phraseId ) : void

Adds a message to this controller's message collection, using the specified phraseId to get the message text.

FilterViewXml ( System.Web.Mvc.ViewContext viewContext, XmlDocument viewXml ) : XmlDocument

Filters the specified viewXml by invoking all FilterViewXml delegates that are accessible by the project at the time of initialization.

Initialize ( System.Web.Routing.RequestContext requestContext ) : void

Initializes the controller with a new SageContext instance.

Private Methods

Method Description
DiscoverViewXmlFilters ( ) : void
InitializeForTesting ( System.Web.Routing.RequestContext requestContext ) : void

Provides a hook to initialize the controller from a unit test

OnAssembliesUpdated ( object sender, EventArgs arg ) : void
SageController ( ) : System

Method Details

AddMessage() protected method

Adds a message to this controller's message collection
protected AddMessage ( MessageType type, string messageText ) : void
type MessageType The type of the message to add.
messageText string The message to display.
return void

AddMessagePhrase() protected method

Adds a message to this controller's message collection, using the specified phraseId to get the message text.
protected AddMessagePhrase ( MessageType type, string phraseId ) : void
type MessageType The type of the message to add.
phraseId string The id of the phrase that contains the text associated with this message.
return void

CreateModule() public method

public CreateModule ( XmlElement moduleElement ) : IModule
moduleElement System.Xml.XmlElement
return IModule

FilterViewXml() protected method

Filters the specified viewXml by invoking all FilterViewXml delegates that are accessible by the project at the time of initialization.
protected FilterViewXml ( System.Web.Mvc.ViewContext viewContext, XmlDocument viewXml ) : XmlDocument
viewContext System.Web.Mvc.ViewContext The view context under which this code is executed.
viewXml System.Xml.XmlDocument The XML document to filter.
return System.Xml.XmlDocument

GetLastModificationDate() public method

Gets the last modification date for the specified viewName.
Each action can and should be cached by the browsers. When subsequent requests come in, browsers will send the last modification date that they received the last time they got that file, in order for the server to figure out whether to send a new version. With sage controllers views, the last modification date is actually the latest modification date of possibly a whole series of files. Those files could be the XSLT style-sheet itself or any one of its includes, or the XML configuration file or any one of its includes. Therefore it is necessary to have this extra piece of logic to effectively determine what that latest modification date is.
public GetLastModificationDate ( string viewName ) : DateTime?
viewName string The name of the action for which to retrieve the last modification date.
return DateTime?

GetViewInfo() public method

Gets the view info corresponding to this controller and the specified viewName.
public GetViewInfo ( string viewName ) : ViewInfo
viewName string The name of the view for which to get the info.
return Sage.Views.ViewInfo

GetViewModel() public method

Processes the view configuration associated with the specified viewInfo, and returns a ViewModel instance that contains the result.
public GetViewModel ( ViewInfo viewInfo ) : ViewModel
viewInfo Sage.Views.ViewInfo The object that contains information about the view.
return Sage.Views.ViewModel

GetViewModel() public method

Processes the view configuration associated with the specified viewName, and returns a ViewModel instance that contains the result.
public GetViewModel ( string viewName ) : ViewModel
viewName string The name of the view to process.
return Sage.Views.ViewModel

Initialize() protected method

Initializes the controller with a new SageContext instance.
protected Initialize ( System.Web.Routing.RequestContext requestContext ) : void
requestContext System.Web.Routing.RequestContext The request context.
return void

PageNotFound() public method

Sets the HTTP status to not found (404) and returns an EmptyResult.
public PageNotFound ( string action = null ) : System.Web.Mvc.ActionResult
action string Optional name of the action that could not be found.
return System.Web.Mvc.ActionResult

PrepareViewXml() public method

Wraps the previously processed view configuration input XML with the standard XML envelope that contains information about the current request, and the resources referenced by the modules and libraries in use by the the view.
public PrepareViewXml ( System.Web.Mvc.ViewContext viewContext ) : XmlDocument
viewContext System.Web.Mvc.ViewContext The view context that contains the that resulted from /// previously processing the view configuration.
return System.Xml.XmlDocument

SageView() public method

Processes the view descibed with the specified viewInfo, and returns an ActionResult.
public SageView ( ViewInfo viewInfo ) : System.Web.Mvc.ActionResult
viewInfo Sage.Views.ViewInfo The object that contains information about the view.
return System.Web.Mvc.ActionResult

SageView() public method

Processes the view configuration associated with the specified viewName, and returns an ActionResult.
public SageView ( string viewName ) : System.Web.Mvc.ActionResult
viewName string The name of the view that should be rendered to response.
return System.Web.Mvc.ActionResult