1 namespace Castle
.MonoRail
.Framework
.Configuration
4 using System
.Configuration
;
8 /// Represents a url mapping
10 public class DefaultUrl
: ISerializedConfig
12 private string url
, controller
, action
, area
;
15 /// Initializes a new instance of the <see cref="DefaultUrl"/> class.
22 /// Initializes a new instance of the <see cref="DefaultUrl"/> class.
24 /// <param name="url">The URL.</param>
25 /// <param name="controller">The controller.</param>
26 /// <param name="action">The action.</param>
27 /// <param name="area">The area.</param>
28 public DefaultUrl(string url
, string controller
, string action
, string area
)
31 this.controller
= controller
;
36 #region ISerializedConfig implementation
39 /// Deserializes the specified section.
41 /// <param name="section">The section.</param>
42 public void Deserialize(XmlNode section
)
44 XmlAttribute urlAtt
= section
.Attributes
["url"];
45 XmlAttribute controllerAtt
= section
.Attributes
["controller"];
46 XmlAttribute actionAtt
= section
.Attributes
["action"];
47 XmlAttribute areaAtt
= section
.Attributes
["area"];
49 if ((urlAtt
== null || urlAtt
.Value
== String
.Empty
) ||
50 (controllerAtt
== null || controllerAtt
.Value
== String
.Empty
) ||
51 (actionAtt
== null || actionAtt
.Value
== String
.Empty
))
53 String message
= "To add a default url rule, please specify the 'url', 'controller', 'action' and optionally 'area' attributes. " +
54 "Check the documentation for more information";
55 throw new ConfigurationErrorsException(message
);
59 action
= actionAtt
.Value
;
60 controller
= controllerAtt
.Value
;
73 /// <value>The URL.</value>
80 /// Gets the controller.
82 /// <value>The controller.</value>
83 public string Controller
85 get { return controller; }
91 /// <value>The action.</value>
94 get { return action; }
100 /// <value>The area.</value>