C# Class Castle.MonoRail.ActiveRecordScaffold.AbstractScaffoldAction

Base abstract class for actions that relate to Scaffolding support. Provide the basic flow process
Inheritance: IDynamicAction
Show file Open project: nats/castle-1.0.3-mono

Protected Properties

Property Type Description
binder Castle.MonoRail.ActiveRecordSupport.ARDataBinder
builder Castle.Components.Binder.TreeBuilder
errors System.Collections.ArrayList
modelType System.Type
prop2Validation IDictionary
templateEngine ITemplateEngine

Public Methods

Method Description
AbstractScaffoldAction ( Type modelType, ITemplateEngine templateEngine, bool useModelName, bool useDefaultLayout ) : System

Initializes a new instance of the AbstractScaffoldAction class.

Execute ( Controller controller ) : void

Executes the basic flow which is Resolve the ActiveRecordModel Resolve the layout (if not is associated with the controller, defaults to "scaffold") Invokes PerformActionProcess which should perform the correct process for this action Resolves the template name that the developer might provide by using ComputeTemplateName If the template exists, renders it. Otherwise invokes RenderStandardHtml

Protected Methods

Method Description
AssertIsPost ( Controller controller ) : void
ComputeTemplateName ( Controller controller ) : string

Implementors should return the template name for the current action.

ObtainPKProperty ( ) : PropertyInfo

Gets the property that represents the Primary key for the current ActiveRecordModel

PerformActionProcess ( Controller controller ) : void

Implementors should perform the action for the scaffolding, like new or create.

RenderFromTemplate ( String templateName, Controller controller ) : void
RenderStandardHtml ( Controller controller ) : void

Only invoked if the programmer havent provided a custom template for the current action. Implementors should create a basic html to present.

SetUpHelpers ( Controller controller ) : void

Private Methods

Method Description
GetARModel ( ) : ActiveRecordModel

Method Details

AbstractScaffoldAction() public method

Initializes a new instance of the AbstractScaffoldAction class.
public AbstractScaffoldAction ( Type modelType, ITemplateEngine templateEngine, bool useModelName, bool useDefaultLayout ) : System
modelType System.Type Type of the model.
templateEngine ITemplateEngine The template engine.
useModelName bool Indicates that we should use the model name on urls
useDefaultLayout bool Whether we should use our layout.
return System

AssertIsPost() protected static method

protected static AssertIsPost ( Controller controller ) : void
controller Castle.MonoRail.Framework.Controller
return void

ComputeTemplateName() protected abstract method

Implementors should return the template name for the current action.
protected abstract ComputeTemplateName ( Controller controller ) : string
controller Castle.MonoRail.Framework.Controller
return string

Execute() public method

Executes the basic flow which is Resolve the ActiveRecordModel Resolve the layout (if not is associated with the controller, defaults to "scaffold") Invokes PerformActionProcess which should perform the correct process for this action Resolves the template name that the developer might provide by using ComputeTemplateName If the template exists, renders it. Otherwise invokes RenderStandardHtml
public Execute ( Controller controller ) : void
controller Castle.MonoRail.Framework.Controller
return void

ObtainPKProperty() protected method

Gets the property that represents the Primary key for the current ActiveRecordModel
protected ObtainPKProperty ( ) : PropertyInfo
return System.Reflection.PropertyInfo

PerformActionProcess() protected method

Implementors should perform the action for the scaffolding, like new or create.
protected PerformActionProcess ( Controller controller ) : void
controller Castle.MonoRail.Framework.Controller
return void

RenderFromTemplate() protected method

protected RenderFromTemplate ( String templateName, Controller controller ) : void
templateName String
controller Castle.MonoRail.Framework.Controller
return void

RenderStandardHtml() protected abstract method

Only invoked if the programmer havent provided a custom template for the current action. Implementors should create a basic html to present.
protected abstract RenderStandardHtml ( Controller controller ) : void
controller Castle.MonoRail.Framework.Controller
return void

SetUpHelpers() protected static method

protected static SetUpHelpers ( Controller controller ) : void
controller Castle.MonoRail.Framework.Controller
return void

Property Details

binder protected property

Binder that 'knows' ActiveRecord types
protected ARDataBinder,Castle.MonoRail.ActiveRecordSupport binder
return Castle.MonoRail.ActiveRecordSupport.ARDataBinder

builder protected property

Constructs the data source for the binder
protected TreeBuilder,Castle.Components.Binder builder
return Castle.Components.Binder.TreeBuilder

errors protected property

A list of errors that happened during this process
protected ArrayList,System.Collections errors
return System.Collections.ArrayList

modelType protected property

Holds the AR type
protected Type,System modelType
return System.Type

prop2Validation protected property

A map of PropertyInfo to validation failures
protected IDictionary prop2Validation
return IDictionary

templateEngine protected property

Reference to the template engine instance
protected ITemplateEngine templateEngine
return ITemplateEngine