Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Configuration / ScaffoldConfig.cs
blobe2e5e21975f8b0c041f2401b8872aa5cd6d5abdb
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;
20 using Framework;
22 /// <summary>
23 /// Represents the Scaffolding support configuration.
24 /// <seealso cref="IScaffoldingSupport"/>
25 /// </summary>
26 public class ScaffoldConfig : ISerializedConfig
28 private Type scaffoldImplType;
30 #region ISerializedConfig implementation
32 /// <summary>
33 /// Deserializes the configuration section looking
34 /// for a 'scaffold' element with a 'type' attribute
35 /// </summary>
36 /// <param name="section">The section.</param>
37 public void Deserialize(XmlNode section)
39 section = section.SelectSingleNode("scaffold");
41 if (section == null) return;
43 XmlAttribute typeAtt = section.Attributes["type"];
45 if (typeAtt == null || typeAtt.Value == String.Empty)
47 String message = "Please specify the 'type' attribute to define an implementation for scaffolding support";
48 throw new ConfigurationErrorsException(message);
51 scaffoldImplType = TypeLoadUtil.GetType(typeAtt.Value);
54 #endregion
56 /// <summary>
57 /// Gets the scaffolding support implementation type.
58 /// <seealso cref="IScaffoldingSupport"/>
59 /// </summary>
60 /// <value>The type of the scaffold impl.</value>
61 public Type ScaffoldImplType
63 get { return scaffoldImplType; }