Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Attributes / DefaultActionAttribute.cs
blob6457371a2fd072508b5262740e905b3a08b1d9fa
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework
17 using System;
19 /// <summary>
20 /// Declares that the Controller should enable a DefaultAction method
21 /// for request processing if no action can be found with the supplied name
22 /// </summary>
23 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple=false), Serializable]
24 public class DefaultActionAttribute : Attribute
26 private static readonly String DEFAULT_ACTION = "DefaultAction";
28 private String defaultAction;
30 /// <summary>
31 /// Constructs a <see cref="DefaultActionAttribute"/>
32 /// using <c>DefaultAction</c>
33 /// as the default action name
34 /// </summary>
35 public DefaultActionAttribute()
37 defaultAction = DEFAULT_ACTION;
40 /// <summary>
41 /// Constructs a <see cref="DefaultActionAttribute"/>
42 /// using the supplied value as the default action name
43 /// </summary>
44 public DefaultActionAttribute(String action)
46 defaultAction = action;
49 /// <summary>
50 /// Gets the default action name
51 /// </summary>
52 public String DefaultAction
54 get { return defaultAction; }