1 namespace Castle
.MonoRail
.Framework
.Configuration
4 using System
.Configuration
;
7 public class DefaultUrl
: ISerializedConfig
9 private string url
, controller
, action
, area
;
12 /// Initializes a new instance of the <see cref="DefaultUrl"/> class.
19 /// Initializes a new instance of the <see cref="DefaultUrl"/> class.
21 /// <param name="url">The URL.</param>
22 /// <param name="controller">The controller.</param>
23 /// <param name="action">The action.</param>
24 /// <param name="area">The area.</param>
25 public DefaultUrl(string url
, string controller
, string action
, string area
)
28 this.controller
= controller
;
33 #region ISerializedConfig implementation
35 public void Deserialize(XmlNode section
)
37 XmlAttribute urlAtt
= section
.Attributes
["url"];
38 XmlAttribute controllerAtt
= section
.Attributes
["controller"];
39 XmlAttribute actionAtt
= section
.Attributes
["action"];
40 XmlAttribute areaAtt
= section
.Attributes
["area"];
42 if ((urlAtt
== null || urlAtt
.Value
== String
.Empty
) ||
43 (controllerAtt
== null || controllerAtt
.Value
== String
.Empty
) ||
44 (actionAtt
== null || actionAtt
.Value
== String
.Empty
))
46 String message
= "To add a default url rule, please specify the 'url', 'controller', 'action' and optionally 'area' attributes. " +
47 "Check the documentation for more information";
48 throw new ConfigurationErrorsException(message
);
52 action
= actionAtt
.Value
;
53 controller
= controllerAtt
.Value
;
66 /// <value>The URL.</value>
73 /// Gets the controller.
75 /// <value>The controller.</value>
76 public string Controller
78 get { return controller; }
84 /// <value>The action.</value>
87 get { return action; }
93 /// <value>The area.</value>