2 // System.Web.Configuration.RootProfilePropertySettingsCollection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Configuration;
36 namespace System.Web.Configuration
38 [ConfigurationCollection (typeof (ProfilePropertySettings), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
39 public sealed class RootProfilePropertySettingsCollection : ProfilePropertySettingsCollection
41 static ConfigurationPropertyCollection properties;
42 ProfileGroupSettingsCollection groupSettings;
44 static RootProfilePropertySettingsCollection ()
46 properties = new ConfigurationPropertyCollection ();
49 public RootProfilePropertySettingsCollection ()
51 groupSettings = new ProfileGroupSettingsCollection ();
54 public override bool Equals (object obj)
56 RootProfilePropertySettingsCollection col = obj as RootProfilePropertySettingsCollection;
60 if (GetType () != col.GetType ())
63 if (Count != col.Count)
66 for (int n = 0; n < Count; n++) {
67 if (!BaseGet (n).Equals (col.BaseGet (n)))
73 public override int GetHashCode ()
76 for (int n = 0; n < Count; n++)
77 code += BaseGet (n).GetHashCode ();
81 protected override bool AllowClear {
85 // LAMESPEC: this is missing from MSDN but is present in 2.0sp1 version of the
87 protected override bool OnDeserializeUnrecognizedElement (string elementName, XmlReader reader)
89 if (elementName == "group") {
90 ProfileGroupSettings newSettings = new ProfileGroupSettings ();
91 newSettings.DoDeserialize (reader);
92 GroupSettings.AddNewSettings (newSettings);
97 return base.OnDeserializeUnrecognizedElement (elementName, reader);
100 // LAMESPEC: this is missing from MSDN, but is present in the 2.0sp1 version of the
102 protected internal override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
105 base.Unmerge (sourceElement, parentElement, saveMode);
108 [ConfigurationProperty ("group")]
109 public ProfileGroupSettingsCollection GroupSettings {
110 get { return groupSettings; }
113 protected internal override ConfigurationPropertyCollection Properties {
114 get { return properties; }
117 protected override bool ThrowOnDuplicate {
122 protected internal override bool IsModified ()
124 return base.IsModified ();
128 protected internal override void ResetModified ()
130 base.ResetModified ();
133 protected internal override void Reset (ConfigurationElement parentElement)
135 base.Reset (parentElement);
137 RootProfilePropertySettingsCollection root = (RootProfilePropertySettingsCollection) parentElement;
141 GroupSettings.ResetInternal (root.GroupSettings);