Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / IController.cs
blobf8edd6888cd6247d11644a6b6b6f0e87e2d8db4b
1 namespace Castle.MonoRail.Framework
3 using System;
4 using System.Collections;
5 using System.Collections.Specialized;
6 using System.IO;
7 using Internal;
9 /// <summary>
10 /// Represent the core functionality required out of a controller
11 /// </summary>
12 public interface IController : IDisposable
14 /// <summary>
15 /// Gets the view folder -- (areaname +
16 /// controllername) or just controller name -- that this controller
17 /// will use by default.
18 /// </summary>
19 string ViewFolder { get; }
21 /// <summary>
22 /// Gets a dicitionary of name/<see cref="IResource"/>
23 /// </summary>
24 /// <remarks>It is supposed to be used by MonoRail infrastructure only</remarks>
25 /// <value>The resources.</value>
26 ResourceDictionary Resources { get; }
28 /// <summary>
29 /// Gets a dictionary of name/helper instance
30 /// </summary>
31 /// <value>The helpers.</value>
32 IDictionary Helpers { get; }
34 /// <summary>
35 /// Gets the controller's name.
36 /// </summary>
37 string Name { get; }
39 /// <summary>
40 /// Gets the controller's area name.
41 /// </summary>
42 string AreaName { get; }
44 /// <summary>
45 /// Gets or set the layout being used.
46 /// </summary>
47 string LayoutName { get; set; }
49 /// <summary>
50 /// Gets the name of the action being processed.
51 /// </summary>
52 string Action { get; }
54 /// <summary>
55 /// Gets or sets the view which will be rendered by this action.
56 /// </summary>
57 string SelectedViewName { get; set; }
59 /// <summary>
60 /// Gets the property bag, which is used
61 /// to pass variables to the view.
62 /// </summary>
63 IDictionary PropertyBag { get; set; }
65 /// <summary>
66 /// Gets a dictionary of volative items.
67 /// Ideal for showing success and failures messages.
68 /// </summary>
69 Flash Flash { get; }
71 /// <summary>
72 /// Gets the request object.
73 /// </summary>
74 IRequest Request { get; }
76 /// <summary>
77 /// Gets the response object.
78 /// </summary>
79 IResponse Response { get; }
81 /// <summary>
82 /// Shortcut to <see cref="IRequest.Params"/>
83 /// </summary>
84 NameValueCollection Params { get; }
86 /// <summary>
87 /// Shortcut to <see cref="IRequest.Form"/>
88 /// </summary>
89 NameValueCollection Form { get; }
91 /// <summary>
92 /// Shortcut to <see cref="IRequest.QueryString"></see>
93 /// </summary>
94 NameValueCollection Query { get; }
96 /// <summary>
97 /// Performs the specified action, which means:
98 /// <br/>
99 /// 1. Define the default view name<br/>
100 /// 2. Run the before filters<br/>
101 /// 3. Select the method related to the action name and invoke it<br/>
102 /// 4. On error, execute the rescues if available<br/>
103 /// 5. Run the after filters<br/>
104 /// 6. Invoke the view engine<br/>
105 /// </summary>
106 /// <param name="action">Action name</param>
107 void Send(string action);
109 /// <summary>
110 /// Performs the specified action with arguments.
111 /// </summary>
112 /// <param name="action">Action name</param>
113 /// <param name="actionArgs">Action arguments</param>
114 void Send(string action, IDictionary actionArgs);
116 /// <summary>
117 /// Invoked by the view engine to perform
118 /// any logic before the view is sent to the client.
119 /// </summary>
120 /// <param name="view"></param>
121 void PreSendView(object view);
123 /// <summary>
124 /// Invoked by the view engine to perform
125 /// any logic after the view had been sent to the client.
126 /// </summary>
127 /// <param name="view"></param>
128 void PostSendView(object view);
130 /// <summary>
131 /// Specifies the shared view to be processed and results are written to System.IO.TextWriter.
132 /// (A partial view shared by others views and usually in the root folder
133 /// of the view directory).
134 /// </summary>
135 /// <param name="output"></param>
136 /// <param name="name">The name of the view to process.</param>
137 void InPlaceRenderSharedView(TextWriter output, string name);