Home

Castle Stronghold

Table of contents

SmartDispatcherController API Document

Specialization of Castle.MonoRail.Framework.Controller that tries to match the request params to method arguments.

Quick Note

You don't even need to always use databinding within arguments. Castle.MonoRail.Framework.SmartDispatcherController.BindObject(System.Type,System.String) and Castle.MonoRail.Framework.SmartDispatcherController.BindObjectInstance(System.Object,System.String) provides the same functionality to be used in place.

Constructors

SmartDispatcherController()

Initializes a new instance of the Castle.MonoRail.Framework.SmartDispatcherController class.

SmartDispatcherController(DataBinder binder)

Missing summary

ParameterDescription
binder Missing documentation

Properties

NameTypeDescription
BinderDataBinder
BoundInstanceErrorsIDictionary
ParamsNodeCompositeNode Lazy initialized property with a hierarchical representation of the flat data on Castle.MonoRail.Framework.Controller.Params
FormNodeCompositeNode Lazy initialized property with a hierarchical representation of the flat data on Castle.MonoRail.Framework.IRequest.Form
QueryStringNodeCompositeNode Lazy initialized property with a hierarchical representation of the flat data on Castle.MonoRail.Framework.IRequest.QueryString
MetaDescriptorControllerMetaDescriptor This is intended to be used by MonoRail infrastructure.
ActionsICollection Gets the actions available in this controller.
ResourcesResourceDictionary Gets a dicitionary of name/Castle.MonoRail.Framework.IResource
HelpersIDictionary Gets a dictionary of name/helper instance
NameString Gets the controller's name.
AreaNameString Gets the controller's area name.
LayoutNameString Gets or set the layout being used.
ActionString Gets the name of the action being processed.
LoggerILogger Logger for the controller
SelectedViewNameString Gets or sets the view which will be rendered by this action.
PropertyBagIDictionary Gets the property bag, which is used to pass variables to the view.
ContextIRailsEngineContext Gets the context of this request execution.
SessionIDictionary Gets the Session dictionary.
FlashFlash Gets a dictionary of volative items. Ideal for showing success and failures messages.
HttpContextHttpContext Gets the web context of ASP.NET API.
RequestIRequest Gets the request object.
ResponseIResponse Gets the response object.
ParamsNameValueCollection Shortcut to Castle.MonoRail.Framework.IRequest.Params
FormNameValueCollection Shortcut to Castle.MonoRail.Framework.IRequest.Form
QueryNameValueCollection Shortcut to Castle.MonoRail.Framework.IRequest.QueryString
DynamicActionsIDictionary
CustomActionsIDictionary
IsClientConnectedBoolean Shortcut to Castle.MonoRail.Framework.IResponse.IsClientConnected
IsPostBackBoolean Determines if the current Action resulted from an ASP.NET PostBack. As a result, this property is only relavent when using WebForms views. It is placed on the base Controller for convenience only to avoid the need to extend the Controller or provide additional helper classes.
ServiceProviderIServiceProvider

Methods

BuildMethodArguments(ParameterInfo[] parameters, IRequest request, Object[] actionArgs) : Object[]

Returns an array that hopefully fills the arguments of the selected action.

Quick Note

Each parameter is inspected and we try to obtain an implementation of Castle.MonoRail.Framework.IParameterBinder from the attributes the parameter have (if any). If an implementation is found, it's used to fill the value for that parameter. Otherwise we use simple conversion to obtain the value.

ParameterDescription
parameters Parameters to obtain the values to
request The current request, which is the source to obtain the data
actionArgs Extra arguments to pass to the action.

GetRequestParameterName(ParameterInfo param) : String

Missing summary

ParameterDescription
param Missing documentation

SelectBestCandidate(MethodInfo[] candidates, NameValueCollection webParams, Object[] actionArgs) : MethodInfo

Missing summary

ParameterDescription
candidates Missing documentation
webParams Missing documentation
actionArgs Missing documentation

PostSendView(Object view)

Invoked by the view engine to perform any logic after the view had been sent to the client.

ParameterDescription
view Missing documentation

PreSendView(Object view)

Invoked by the view engine to perform any logic before the view is sent to the client.

ParameterDescription
view Missing documentation

Initialize()

Missing summary

GetRescueFor(IList rescues, Type exceptionType) : RescueDescriptor

ParameterDescription
rescues Missing documentation
exceptionType Missing documentation

PerformRescue(MethodInfo method, Exception ex) : Boolean

ParameterDescription
method Missing documentation
ex Missing documentation

ObtainDefaultLayoutName() : String

ReleaseResources()

CreateResources(MethodInfo method)

ParameterDescription
method Missing documentation

InvokeMethod(MethodInfo method, IRequest request, Object[] actionArgs)

Missing summary

ParameterDescription
method Missing documentation
request Missing documentation
actionArgs Missing documentation

SelectMethod(String action, IDictionary actions, IRequest request, Object[] actionArgs) : MethodInfo

Missing summary

ParameterDescription
action Missing documentation
actions Missing documentation
request Missing documentation
actionArgs Missing documentation

CreateAndInitializeHelpers()

InternalSend(String action, Object[] actionArgs)

Performs the specified action, which means:

1. Define the default view name

2. Run the before filters

3. Select the method related to the action name and invoke it

4. On error, execute the rescues if available

5. Run the after filters

6. Invoke the view engine

ParameterDescription
action Missing documentation
actionArgs Missing documentation

Redirect(String url, IDictionary parameters)

Redirects to the specified URL.

ParameterDescription
url Missing documentation
parameters Missing documentation

Redirect(String url)

Redirects to the specified URL. All other Redirects call this one.

ParameterDescription
url Missing documentation

CalculatePoints(MethodInfo candidate, NameValueCollection webParams, Object[] actionArgs) : Int32

Uses a simplest algorithm to compute points for a method based on parameters available, which in turn reflects the best method is the one which the parameters will be able to satistfy more arguments

ParameterDescription
candidate The method candidate
webParams Parameter source
actionArgs Extra parameters

BindObject(Type targetType, String prefix) : Object

Missing summary

ParameterDescription
targetType Missing documentation
prefix Missing documentation

BindObject(ParamStore from, Type targetType, String prefix) : Object

Missing summary

ParameterDescription
from Missing documentation
targetType Missing documentation
prefix Missing documentation

BindObject(ParamStore from, Type targetType, String prefix, String excludedProperties, String allowedProperties) : Object

Missing summary

ParameterDescription
from Missing documentation
targetType Missing documentation
prefix Missing documentation
excludedProperties Missing documentation
allowedProperties Missing documentation

BindObjectInstance(Object instance, String prefix)

Missing summary

ParameterDescription
instance Missing documentation
prefix Missing documentation

BindObjectInstance(Object instance, ParamStore from, String prefix)

Missing summary

ParameterDescription
instance Missing documentation
from Missing documentation
prefix Missing documentation

GetDataBindErrors(Object instance) : ErrorList

Missing summary

ParameterDescription
instance Missing documentation

ObtainParamsNode(ParamStore from) : CompositeNode

This method is for internal use only

ParameterDescription
from

RenderView(String name)

Specifies the view to be processed after the action has finished its processing.

ParameterDescription
name Missing documentation

RenderView(String name, Boolean skipLayout)

Specifies the view to be processed after the action has finished its processing.

ParameterDescription
name Missing documentation
skipLayout Missing documentation

RenderView(String controller, String name)

Specifies the view to be processed after the action has finished its processing.

ParameterDescription
controller Missing documentation
name Missing documentation

RenderView(String controller, String name, Boolean skipLayout)

Specifies the view to be processed after the action has finished its processing.

ParameterDescription
controller Missing documentation
name Missing documentation
skipLayout Missing documentation

InPlaceRenderView(TextWriter output, String name)

Specifies the view to be processed and results are written to System.IO.TextWriter.

ParameterDescription
output Missing documentation
name Missing documentation

RenderSharedView(String name)

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).

ParameterDescription
name Missing documentation

RenderSharedView(String name, Boolean skipLayout)

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).

ParameterDescription
name Missing documentation
skipLayout Missing documentation

InPlaceRenderSharedView(TextWriter output, String name)

Specifies the shared view to be processed and results are written to System.IO.TextWriter. (A partial view shared by others views and usually in the root folder of the view directory).

ParameterDescription
output Missing documentation
name Missing documentation

CancelView()

Cancels the view processing.

CancelLayout()

Cancels the layout processing.

RenderText(String contents)

Cancels the view processing and writes the specified contents to the browser

ParameterDescription
contents Missing documentation

RenderText(String contents, Object[] args)

Cancels the view processing and writes the specified contents to the browser

ParameterDescription
contents Missing documentation
args Missing documentation

RenderText(IFormatProvider formatProvider, String contents, Object[] args)

Cancels the view processing and writes the specified contents to the browser

ParameterDescription
formatProvider Missing documentation
contents Missing documentation
args Missing documentation

DirectRender(String contents)

Sends raw contents to be rendered directly by the view engine. It's up to the view engine just to apply the layout and nothing else.

ParameterDescription
contents Missing documentation

HasTemplate(String templateName) : Boolean

Returns true if the specified template exists.

ParameterDescription
templateName Missing documentation

RedirectToAction(String action)

Redirects to another action in the same controller.

ParameterDescription
action Missing documentation

RedirectToAction(String action, String[] queryStringParameters)

Redirects to another action in the same controller.

ParameterDescription
action Missing documentation
queryStringParameters Missing documentation

RedirectToAction(String action, IDictionary queryStringParameters)

Redirects to another action in the same controller.

ParameterDescription
action Missing documentation
queryStringParameters Missing documentation

RedirectToAction(String action, NameValueCollection queryStringParameters)

Redirects to another action in the same controller.

ParameterDescription
action Missing documentation
queryStringParameters Missing documentation

CreateAbsoluteRailsUrl(String area, String controller, String action) : String

ParameterDescription
area Missing documentation
controller Missing documentation
action Missing documentation

CreateAbsoluteRailsUrl(String controller, String action) : String

ParameterDescription
controller Missing documentation
action Missing documentation

CreateAbsoluteRailsUrlForAction(String action) : String

ParameterDescription
action Missing documentation

Redirect(String controller, String action)

Redirects to another controller and action.

ParameterDescription
controller Missing documentation
action Missing documentation

Redirect(String area, String controller, String action)

Redirects to another controller and action.

ParameterDescription
area Missing documentation
controller Missing documentation
action Missing documentation

Redirect(String controller, String action, NameValueCollection parameters)

Redirects to another controller and action with the specified paramters.

ParameterDescription
controller Missing documentation
action Missing documentation
parameters Missing documentation

Redirect(String area, String controller, String action, NameValueCollection parameters)

Redirects to another controller and action with the specified paramters.

ParameterDescription
area Missing documentation
controller Missing documentation
action Missing documentation
parameters Missing documentation

Redirect(String controller, String action, IDictionary parameters)

Redirects to another controller and action with the specified paramters.

ParameterDescription
controller Missing documentation
action Missing documentation
parameters Missing documentation

Redirect(String area, String controller, String action, IDictionary parameters)

Redirects to another controller and action with the specified paramters.

ParameterDescription
area Missing documentation
controller Missing documentation
action Missing documentation
parameters Missing documentation

ToQueryString(NameValueCollection parameters) : String

ParameterDescription
parameters Missing documentation

ToQueryString(IDictionary parameters) : String

ParameterDescription
parameters Missing documentation

Send(String action)

Performs the specified action, which means:

1. Define the default view name

2. Run the before filters

3. Select the method related to the action name and invoke it

4. On error, execute the rescues if available

5. Run the after filters

6. Invoke the view engine

ParameterDescription
action Missing documentation

Send(String action, Object[] actionArgs)

Performs the specified action with arguments.

ParameterDescription
action Missing documentation
actionArgs Missing documentation

ShouldSkip(MethodInfo method, IDictionary filtersToSkip) : Boolean

ParameterDescription
method Missing documentation
filtersToSkip Missing documentation

CopyFilterDescriptors() : FilterDescriptor[]

Clones all Filter descriptors, in order to get a writable copy.

RenderMailMessage(String templateName) : Message

Creates an instance of Castle.Components.Common.EmailSender.Message using the specified template for the body

ParameterDescription
templateName Missing documentation

DeliverEmail(Message message)

Attempts to deliver the Message using the server specified on the web.config.

ParameterDescription
message Missing documentation

RenderEmailAndSend(String templateName)

Renders and delivers the e-mail message.

ParameterDescription
templateName Missing documentation

RaiseOnActionExceptionOnExtension()

Google
Search WWW Search castleproject.org