0
|
1 using System;
|
|
2 using System.Collections.Specialized;
|
|
3 using System.Configuration;
|
|
4
|
|
5 namespace BLToolkit.Configuration
|
|
6 {
|
|
7 internal abstract class ElementBase : ConfigurationElement
|
|
8 {
|
|
9 protected ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();
|
|
10
|
|
11 protected override ConfigurationPropertyCollection Properties
|
|
12 {
|
|
13 get { return _properties; }
|
|
14 }
|
|
15
|
|
16 /// <summary>
|
|
17 /// Gets a value indicating whether an unknown attribute is encountered during deserialization.
|
|
18 /// </summary>
|
|
19 /// <returns>
|
|
20 /// True when an unknown attribute is encountered while deserializing.
|
|
21 /// </returns>
|
|
22 /// <param name="name">The name of the unrecognized attribute.</param>
|
|
23 /// <param name="value">The value of the unrecognized attribute.</param>
|
|
24 protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
|
|
25 {
|
|
26 ConfigurationProperty property = new ConfigurationProperty(name, typeof(string), value);
|
|
27 _properties.Add(property);
|
|
28 base[property] = value;
|
|
29 Attributes.Add(name, value);
|
|
30 return true;
|
|
31 }
|
|
32
|
|
33 private NameValueCollection _attributes;
|
|
34 public NameValueCollection Attributes
|
|
35 {
|
|
36 get { return _attributes ?? (_attributes = new NameValueCollection(StringComparer.OrdinalIgnoreCase));}
|
|
37 }
|
|
38 }
|
|
39 } |