Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Framework / Configuration / ScaffoldConfig.cs
blob060eb300b03cba7b00d6073311423aa49be6798b
1 // Copyright 2004-2008 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 /// <summary>
31 /// Initializes a new instance of the <see cref="ScaffoldConfig"/> class.
32 /// </summary>
33 public ScaffoldConfig()
35 TryLoadDefaultScaffoldingImplementation();
38 #region ISerializedConfig implementation
40 /// <summary>
41 /// Deserializes the configuration section looking
42 /// for a 'scaffold' element with a 'type' attribute
43 /// </summary>
44 /// <param name="section">The section.</param>
45 public void Deserialize(XmlNode section)
47 section = section.SelectSingleNode("scaffold");
49 if (section == null) return;
51 XmlAttribute typeAtt = section.Attributes["type"];
53 if (typeAtt == null || typeAtt.Value == String.Empty)
55 String message = "Please specify the 'type' attribute to define an implementation for scaffolding support";
56 throw new ConfigurationErrorsException(message);
59 scaffoldImplType = TypeLoadUtil.GetType(typeAtt.Value);
62 #endregion
64 /// <summary>
65 /// Gets the scaffolding support implementation type.
66 /// <seealso cref="IScaffoldingSupport"/>
67 /// </summary>
68 /// <value>The type of the scaffold impl.</value>
69 public Type ScaffoldImplType
71 get { return scaffoldImplType; }
74 private void TryLoadDefaultScaffoldingImplementation()
76 scaffoldImplType = Type.GetType("Castle.MonoRail.ActiveRecordSupport.Scaffold.ScaffoldingSupport, Castle.MonoRail.ActiveRecordSupport", false, false);