Browse Source

2007-12-27 Marek Habersack <[email protected]>

	* ProfileGroupSettingsCollection.cs: added an internal method to
	add/overwrite new group settings. Used from
	RootProfilePropertySettingsCollection.

	* ProfileGroupSettings.cs: added the missing "name" property to
	the properties collection.
	Marked the propertySettingsProp property as the default
	collection.
	Added internal deserialization method, used from
	RootProfilePropertySettingsCollection to support the 'group'
	element.

	* ProfileSection.cs: defaultProviderProp typo - the name of the
	provider should be "AspNetSqlProfileProvider"

	* RootProfilePropertySettingsCollection.cs: added
	OnDeseerializeUnrecognizedElement to support the profile 'group'
	element.
	Added a missing Unmerge method.

svn path=/trunk/mcs/; revision=91931
Marek Habersack 18 years ago
parent
commit
021aece48b

+ 22 - 0
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog

@@ -1,3 +1,25 @@
+2007-12-27  Marek Habersack  <[email protected]>
+
+	* ProfileGroupSettingsCollection.cs: added an internal method to
+	add/overwrite new group settings. Used from
+	RootProfilePropertySettingsCollection.
+
+	* ProfileGroupSettings.cs: added the missing "name" property to
+	the properties collection.
+	Marked the propertySettingsProp property as the default
+	collection.
+	Added internal deserialization method, used from
+	RootProfilePropertySettingsCollection to support the 'group'
+	element.
+
+	* ProfileSection.cs: defaultProviderProp typo - the name of the
+	provider should be "AspNetSqlProfileProvider"
+
+	* RootProfilePropertySettingsCollection.cs: added
+	OnDeseerializeUnrecognizedElement to support the profile 'group'
+	element.
+	Added a missing Unmerge method.
+
 2007-12-11  Vladimir Krasnov  <[email protected]>
 
 	* SiteMapSection.cs: fixed ProvidersInternal property to be thread safe

+ 15 - 4
mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs

@@ -33,21 +33,27 @@
 using System;
 using System.ComponentModel;
 using System.Configuration;
+using System.Xml;
 
 namespace System.Web.Configuration
 {
 	public sealed class ProfileGroupSettings : ConfigurationElement
 	{
 		static ConfigurationProperty propertySettingsProp;
+		static ConfigurationProperty nameProp;
 		
 		static ConfigurationPropertyCollection properties;
 		
 		static ProfileGroupSettings ()
 		{
-			propertySettingsProp = new ConfigurationProperty (null, typeof (ProfilePropertySettingsCollection), null);
-
+			propertySettingsProp = new ConfigurationProperty (null, typeof (ProfilePropertySettingsCollection), null, null, null,
+									  ConfigurationPropertyOptions.IsDefaultCollection);
+			nameProp = new ConfigurationProperty ("name", typeof (string), null, null, PropertyHelper.NonEmptyStringValidator,
+							      ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
+			
 			properties = new ConfigurationPropertyCollection ();
 			properties.Add (propertySettingsProp);
+			properties.Add (nameProp);
 		}
 		
 		internal ProfileGroupSettings ()
@@ -76,10 +82,15 @@ namespace System.Web.Configuration
 			return Name.GetHashCode ();
 		}
 
+		internal void DoDeserialize (XmlReader reader)
+		{
+			DeserializeElement (reader, false);
+		}
+		
 		[ConfigurationProperty ("name", IsRequired = true, IsKey = true)]
 		public string Name {
-			get { return (string)base ["name"]; }
-			internal set { base ["name"] = value; }
+			get { return (string)base [nameProp]; }
+			internal set { base [nameProp] = value; }
 		}
 
 		[ConfigurationProperty ("", Options = ConfigurationPropertyOptions.IsDefaultCollection)]

+ 6 - 0
mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettingsCollection.cs

@@ -148,6 +148,12 @@ namespace System.Web.Configuration
 		{
 			Reset (parentElement);
 		}
+
+		internal void AddNewSettings (ProfileGroupSettings newSettings)
+		{
+			// allow overriding - no exception should be thrown
+			BaseAdd (newSettings, false);
+		}
 	}
 
 }

+ 1 - 1
mcs/class/System.Web/System.Web.Configuration_2.0/ProfileSection.cs

@@ -50,7 +50,7 @@ namespace System.Web.Configuration
 		{
 			automaticSaveEnabledProp = new ConfigurationProperty ("automaticSaveEnabled", typeof (bool), true);
 			defaultProviderProp = new ConfigurationProperty ("defaultProvider", typeof (string),
-									 "AspnetSqlProfileProvider");
+									 "AspNetSqlProfileProvider");
 			enabledProp = new ConfigurationProperty ("enabled", typeof (bool), true);
 			inheritsProp = new ConfigurationProperty ("inherits", typeof (string), "");
 			propertySettingsProp = new ConfigurationProperty ("properties", typeof (RootProfilePropertySettingsCollection));

+ 23 - 1
mcs/class/System.Web/System.Web.Configuration_2.0/RootProfilePropertySettingsCollection.cs

@@ -40,7 +40,6 @@ namespace System.Web.Configuration
 	public sealed class RootProfilePropertySettingsCollection : ProfilePropertySettingsCollection
 	{
 		static ConfigurationPropertyCollection properties;
-
 		ProfileGroupSettingsCollection groupSettings;
 		
 		static RootProfilePropertySettingsCollection ()
@@ -83,6 +82,29 @@ namespace System.Web.Configuration
 		protected override bool AllowClear {
 			get { return true; }
 		}
+
+		// LAMESPEC: this is missing from MSDN but is present in 2.0sp1 version of the
+		// class.
+		protected override bool OnDeserializeUnrecognizedElement (string elementName, XmlReader reader)
+		{
+			if (elementName == "group") {
+				ProfileGroupSettings newSettings = new ProfileGroupSettings ();
+				newSettings.DoDeserialize (reader);
+				GroupSettings.AddNewSettings (newSettings);
+				
+				return true;
+			}
+			
+			return base.OnDeserializeUnrecognizedElement (elementName, reader);
+		}
+
+		// LAMESPEC: this is missing from MSDN, but is present in the 2.0sp1 version of the
+		// class
+		protected override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
+		{
+			// Why override?
+			base.Unmerge (sourceElement, parentElement, saveMode);
+		}
 		
 		[ConfigurationProperty ("group")]
 		public ProfileGroupSettingsCollection GroupSettings {