forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplateServiceConfigurationElementCollection.cs
More file actions
66 lines (60 loc) · 2.59 KB
/
Copy pathTemplateServiceConfigurationElementCollection.cs
File metadata and controls
66 lines (60 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.Configuration;
namespace ServiceStack.RazorEngine.Configuration
{
/// <summary>
/// Represents a collection of <see cref="TemplateServiceConfigurationElement"/> items.
/// </summary>
[ConfigurationCollection(typeof(TemplateServiceConfigurationElement))]
public class TemplateServiceConfigurationElementConfiguration : ConfigurationElementCollection
{
#region Fields
private const string DefaultAttribute = "default";
#endregion
#region Properties
/// <summary>
/// Gets or sets the default template service.
/// </summary>
public string Default { get; private set; }
#endregion
#region Methods
/// <summary>
/// When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </returns>
protected override ConfigurationElement CreateNewElement()
{
return new TemplateServiceConfigurationElement();
}
/// <summary>
/// Gets the element key for a specified configuration element when overridden in a derived class.
/// </summary>
/// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param>
/// <returns>
/// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </returns>
protected override object GetElementKey(ConfigurationElement element)
{
return ((TemplateServiceConfigurationElement)element).Name;
}
/// <summary>
/// Gets a value indicating whether an unknown attribute is encountered during deserialization.
/// </summary>
/// <param name="name">The name of the unrecognized attribute.</param>
/// <param name="value">The value of the unrecognized attribute.</param>
/// <returns>
/// true when an unknown attribute is encountered while deserializing; otherwise, false.
/// </returns>
protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
{
if (name.Equals("default"))
{
Default = value;
return true;
}
return base.OnDeserializeUnrecognizedAttribute(name, value);
}
#endregion
}
}