Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Configuration / MonoRailSectionHandler.cs
blob1ade076aa40df1c26d0875e285739bb30a44ea40
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.Configuration
17 using System;
18 using System.Configuration;
19 using System.Xml;
21 /// <summary>
22 /// The MonoRail section handler
23 /// </summary>
24 public class MonoRailSectionHandler : IConfigurationSectionHandler
26 /// <summary>
27 /// Initializes a new instance of the <see cref="MonoRailSectionHandler"/> class.
28 /// </summary>
29 public MonoRailSectionHandler()
33 /// <summary>
34 /// Creates a configuration section handler.
35 /// </summary>
36 /// <param name="parent"></param>
37 /// <param name="configContext">Configuration context object.</param>
38 /// <param name="section"></param>
39 /// <returns>The created section handler object.</returns>
40 public virtual object Create(object parent, object configContext, XmlNode section)
42 MonoRailConfiguration config = new MonoRailConfiguration(section);
44 Deserialize(section, config);
46 return config;
49 /// <summary>
50 /// Deserializes the config section.
51 /// </summary>
52 /// <param name="section">The section.</param>
53 /// <param name="config">The config.</param>
54 private void Deserialize(XmlNode section, MonoRailConfiguration config)
56 config.Deserialize(section);