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.
34 using System
.Configuration
;
37 namespace System
.Web
.Configuration
39 [ConfigurationCollection (typeof (ProfilePropertySettings
), CollectionType
= ConfigurationElementCollectionType
.AddRemoveClearMap
)]
40 public sealed class RootProfilePropertySettingsCollection
: ProfilePropertySettingsCollection
42 static ConfigurationPropertyCollection properties
;
43 ProfileGroupSettingsCollection groupSettings
;
45 static RootProfilePropertySettingsCollection ()
47 properties
= new ConfigurationPropertyCollection ();
50 public RootProfilePropertySettingsCollection ()
52 groupSettings
= new ProfileGroupSettingsCollection ();
55 public override bool Equals (object obj
)
57 RootProfilePropertySettingsCollection col
= obj
as RootProfilePropertySettingsCollection
;
61 if (GetType () != col
.GetType ())
64 if (Count
!= col
.Count
)
67 for (int n
= 0; n
< Count
; n
++) {
68 if (!BaseGet (n
).Equals (col
.BaseGet (n
)))
74 public override int GetHashCode ()
77 for (int n
= 0; n
< Count
; n
++)
78 code
+= BaseGet (n
).GetHashCode ();
82 protected override bool AllowClear
{
86 // LAMESPEC: this is missing from MSDN but is present in 2.0sp1 version of the
88 protected override bool OnDeserializeUnrecognizedElement (string elementName
, XmlReader reader
)
90 if (elementName
== "group") {
91 ProfileGroupSettings newSettings
= new ProfileGroupSettings ();
92 newSettings
.DoDeserialize (reader
);
93 GroupSettings
.AddNewSettings (newSettings
);
98 return base.OnDeserializeUnrecognizedElement (elementName
, reader
);
101 // LAMESPEC: this is missing from MSDN, but is present in the 2.0sp1 version of the
103 protected override void Unmerge (ConfigurationElement sourceElement
, ConfigurationElement parentElement
, ConfigurationSaveMode saveMode
)
106 base.Unmerge (sourceElement
, parentElement
, saveMode
);
109 [ConfigurationProperty ("group")]
110 public ProfileGroupSettingsCollection GroupSettings
{
111 get { return groupSettings; }
114 protected override ConfigurationPropertyCollection Properties
{
115 get { return properties; }
118 protected override bool ThrowOnDuplicate
{
123 protected override bool IsModified ()
125 return base.IsModified ();
129 protected override void ResetModified ()
131 base.ResetModified ();
134 protected override void Reset (ConfigurationElement parentElement
)
136 base.Reset (parentElement
);
138 RootProfilePropertySettingsCollection root
= (RootProfilePropertySettingsCollection
) parentElement
;
142 GroupSettings
.ResetInternal (root
.GroupSettings
);