Click here to Skip to main content
15,886,724 members
Articles / Web Development / ASP.NET

Monorail Hands-On

Rate me:
Please Sign up or sign in to vote.
4.78/5 (15 votes)
19 Feb 2008CPOL9 min read 71.2K   1.1K   40  
In this article, I will present a sample application using the Monorail framework and provide the basic concepts of the design pattern known as MVC.
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>Castle.MonoRail.Views.Brail</name>
    </assembly>
    <members>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.compilations">
            <summary>
            This field holds all the cache of all the 
            compiled types (not instances) of all the views that Brail nows of.
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.constructors">
            <summary>
            used to hold the constructors of types, so we can avoid using
            Activator (which takes a long time
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BooViewEngine.common">
            <summary>
            This is used to add a reference to the common scripts for each compiled scripts
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BooViewEngine.ResolveTemplateName(System.String,System.String)">
            <summary>
            Resolves the template name into a  file name.
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BooViewEngine.DoCompile(System.Collections.Generic.ICollection{Boo.Lang.Compiler.ICompilerInput},System.String)">
            <summary>
            Perform the actual compilation of the scripts
            Things to note here:
            * The generated assembly reference the Castle.MonoRail.MonoRailBrail and Castle.MonoRail.Framework assemblies
            * If a common scripts assembly exist, it is also referenced
            * The AddBrailBaseClassStep compiler step is added - to create a class from the view's code
            * The ProcessMethodBodiesWithDuckTyping is replaced with ReplaceUknownWithParameters
              this allows to use naked parameters such as (output context.IsLocal) without using 
              any special syntax
            * The ExpandDuckTypedExpressions is replace with a derived step that allows the use of Dynamic Proxy assemblies
            * The IntroduceGlobalNamespaces step is removed, to allow to use common variables such as 
              date and list without accidently using the Boo.Lang.BuiltIn versions
            </summary>
            <param name="files"></param>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.BrailBase">
             <summary>
            Base class for all the view scripts, this is the class that is responsible for
             support all the behind the scenes magic such as variable to PropertyBag trasnlation, 
             resources usage, etc. 
             </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.childOutput">
            <summary>
            This is used by layout scripts only, for outputing the child's content
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.viewComponentsParameters">
            <summary>
            used to hold the ComponentParams from the view, so their views/sections could access them
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase.parent">
            <summary>
            usually used by the layout to refer to its view, or a subview to its parent
            </summary>
        </member>
        <member name="F:Castle.MonoRail.Views.Brail.BrailBase._dsl">
            <summary>
            Reference to the DSL service
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.#ctor(Castle.MonoRail.Views.Brail.BooViewEngine,System.IO.TextWriter,Castle.MonoRail.Framework.IRailsEngineContext,Castle.MonoRail.Framework.Controller)">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailBase"/> class.
            </summary>
            <param name="viewEngine">The view engine.</param>
            <param name="output">The output.</param>
            <param name="context">The context.</param>
            <param name="__controller">The controller.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.Run">
            <summary>
            Runs this instance, this is generated by the script
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String)">
            <summary>
            Output the subview to the client, this is either a relative path "SubView" which
            is relative to the current /script/ or an "absolute" path "/home/menu" which is
            actually relative to ViewDirRoot
            </summary>
            <param name="subviewName"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String,System.Collections.IDictionary)">
            <summary>
            Similiar to the OutputSubView(string) function, but with a bunch of parameters that are used
            just for this subview. This parameters are /not/ inheritable.
            </summary>
            <returns>An empty string, just to make it possible to use inline ${OutputSubView("foo")}</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.OutputSubView(System.String,System.IO.TextWriter,System.Collections.IDictionary)">
            <summary>
            Outputs the sub view to the writer
            </summary>
            <param name="subviewName">Name of the subview.</param>
            <param name="writer">The writer.</param>
            <param name="parameters">The parameters.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetSubViewFilename(System.String)">
            <summary>
            Get the sub view file name, if the subview starts with a '/' 
            then the filename is considered relative to ViewDirRoot
            otherwise, it's relative to the current script directory
            </summary>
            <param name="subviewName"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetParameter(System.String)">
            <summary>
            this is called by ReplaceUnknownWithParameters step to create a more dynamic experiance
            any uknown identifier will be translate into a call for GetParameter('identifier name').
            This mean that when an uknonwn identifier is in the script, it will only be found on runtime.
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.TryGetParameter(System.String)">
            <summary>
            this is called by ReplaceUnknownWithParameters step to create a more dynamic experiance
            any uknown identifier with the prefix of ? will be translated into a call for 
            TryGetParameter('identifier name without the ? prefix').
            This method will return null if the value it not found.
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.GetParameterInternal(System.String)">
            <summary>
            Gets the parameter - implements the logic for searching parameters.
            </summary>
            <param name="name">The name.</param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.SetParent(Castle.MonoRail.Views.Brail.BrailBase)">
            <summary>
            Sets the parent.
            </summary>
            <param name="myParent">My parent.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.IsDefined(System.String)">
            <summary>
            Allows to check that a parameter was defined
            </summary>
            <param name="name"></param>
            <returns></returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.SetOutputStream(System.IO.TextWriter)">
            <summary>
            This is required because we may want to replace the output stream and get the correct
            behavior from components call RenderText() or RenderSection()
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.AddProperty(System.String,System.Object)">
            <summary>
            Note that this will overwrite any existing property.
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.AddViewComponentProperties(System.Collections.IDictionary)">
            <summary>
            Adds the view component newProperties.
            This will be included in the parameters searching, note that this override
            the current parameters if there are clashing.
            The search order is LIFO
            </summary>
            <param name="newProperties">The newProperties.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.RemoveViewComponentProperties(System.Collections.IDictionary)">
            <summary>
            Removes the view component properties, so they will no longer be visible to the views.
            </summary>
            <param name="propertiesToRemove">The properties to remove.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailBase.InitProperties(Castle.MonoRail.Framework.IRailsEngineContext,Castle.MonoRail.Framework.Controller)">
            <summary>
            Initialize all the properties that a script may need
            One thing to note here is that resources are wrapped in ResourceToDuck wrapper
            to enable easy use by the script
            </summary>
            <param name="myContext"></param>
            <param name="myController"></param>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ScriptDirectory">
             <summary>
            The path of the script, this is filled by AddBrailBaseClassStep
             and is used for sub views 
             </summary>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ViewEngine">
            <summary>
            Gets the view engine.
            </summary>
            <value>The view engine.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Dsl">
            <summary>
            Gets the DSL provider
            </summary>
            <value>Reference to the current DSL Provider</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Flash">
            <summary>
            Gets the flash.
            </summary>
            <value>The flash.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.OutputStream">
            <summary>
            Gets the output stream.
            </summary>
            <value>The output stream.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.ChildOutput">
            <summary>
            Gets or sets the child output.
            </summary>
            <value>The child output.</value>
        </member>
        <member name="P:Castle.MonoRail.Views.Brail.BrailBase.Properties">
            <summary>
            Gets the properties.
            </summary>
            <value>The properties.</value>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.BrailJSGenerator">
            <summary>
            
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackGet(System.String,System.Object[])">
            <summary>
            Defines the behavior when a property is read
            </summary>
            <param name="propName">Property name.</param>
            <param name="parameters">Parameters for indexers</param>
            <returns>value back to the template</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackSet(System.String,System.Object[],System.Object)">
            <summary>
            Defines the behavior when a property is written
            </summary>
            <param name="propName">Property name.</param>
            <param name="parameters">Parameters for indexers</param>
            <param name="value">The value to assign.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.QuackInvoke(System.String,System.Object[])">
            <summary>
            Invokes the specified method.
            </summary>
            <param name="method">The method name.</param>
            <param name="args">The method arguments.</param>
            <returns>value back to the template</returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailJSGenerator.ToString">
            <summary>
            Delegates to the generator
            </summary>
            <returns>
            A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
            </returns>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailPreProcessor.GetExpressionsPositions(System.String)">
            <summary>
            Will find all the (outer most ${} expressions in the code, and return their positions).
            Smart enough to figure out $${} escaping, but not much more
            </summary>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.#ctor(Castle.MonoRail.Views.Brail.BrailBase,Boo.Lang.ICallable,System.String,System.IO.TextWriter,System.Collections.IDictionary)">
            <summary>
            Initializes a new instance of the <see cref="T:Castle.MonoRail.Views.Brail.BrailViewComponentContext"/> class.
            </summary>
            <param name="parent">The parent.</param>
            <param name="body">The body.</param>
            <param name="name">The name.</param>
            <param name="text">The text.</param>
            <param name="parameters">The parameters.</param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.RenderView(System.String,System.IO.TextWriter)">
            <summary>
            Pendent
            </summary>
            <param name="name"></param>
            <param name="writer"></param>
        </member>
        <member name="M:Castle.MonoRail.Views.Brail.BrailViewComponentContext.RenderSection(System.String,System.IO.TextWriter)">
            <summary>
            Renders the the specified section
            </summary>
            <param name="sectionName">Name of the section.</param>
            <param name="writer">The writer.</param>
        </member>
        <member name="T:Castle.MonoRail.Views.Brail.ExpandDuckTypedExpressions_WorkaroundForDuplicateVirtualMethods">
            <summary>
            This is here because we need to overcome a tendecy of Dynamic Proxy to generate virtual override that
            do not match exactly what the compiler does.
            This means that when you do GetMethod("Foo") and DP has proxied it, you would get an exception because it would
            recognize two methods with this name.
            We recognize when we are trying to invoke something that DP has build and act accordingly.
            
            The code is mostly taken fro Boo.Lang.Runtime.RuntimeServices, and modified to understand that when the type is from DP, is should
            use DeclareOnly
            </summary>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer Alura Cursos Online
Brazil Brazil

Comments and Discussions