Author: krasnov
Date: 2006-11-05 09:15:01 -0500 (Sun, 05 Nov 2006)
New Revision: 67377
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettingsCollection.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfilePropertySettingsCollection.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileSection.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/RootProfilePropertySettingsCollection.cs
Log:
* ProfileGroupSettings.cs, ProfileGroupSettingsCollection.cs,
ProfilePropertySettingsCollection.cs, ProfileSection.cs,
RootProfilePropertySettingsCollection.cs: refactoring and fix of <group> element
Modified: trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
2006-11-05 14:09:18 UTC (rev 67376)
+++ trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
2006-11-05 14:15:01 UTC (rev 67377)
@@ -1,3 +1,10 @@
+2006-11-05 Vladimir Krasnov <[EMAIL PROTECTED]>
+
+ * ProfileGroupSettings.cs, ProfileGroupSettingsCollection.cs
+ ProfilePropertySettingsCollection.cs, ProfileSection.cs
+ RootProfilePropertySettingsCollection.cs: refactoring and fix of
+ <group> element
+
2006-10-18 Marek Habersack <[EMAIL PROTECTED]>
* WebConfigurationManager.cs: implement support for extra
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs
2006-11-05 14:09:18 UTC (rev 67376)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettings.cs
2006-11-05 14:15:01 UTC (rev 67377)
@@ -38,26 +38,6 @@
{
public sealed class ProfileGroupSettings : ConfigurationElement
{
- static ConfigurationPropertyCollection properties;
- static ConfigurationProperty nameProp;
- static ConfigurationProperty propertySettingsProp;
-
- static ProfileGroupSettings ()
- {
- nameProp = new ConfigurationProperty ("name", typeof
(string), null,
-
TypeDescriptor.GetConverter (typeof (string)),
- new
ProfilePropertyNameValidator (),
-
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
- propertySettingsProp = new ConfigurationProperty ("",
typeof (ProfilePropertySettingsCollection), null,
- null,
-
PropertyHelper.DefaultValidator,
-
ConfigurationPropertyOptions.IsDefaultCollection);
-
- properties = new ConfigurationPropertyCollection ();
- properties.Add (nameProp);
- properties.Add (propertySettingsProp);
- }
-
internal ProfileGroupSettings ()
{
}
@@ -67,10 +47,16 @@
this.Name = name;
}
- [MonoTODO]
public override bool Equals (object obj)
{
- throw new NotImplementedException ();
+ ProfileGroupSettings other = obj as
ProfileGroupSettings;
+ if (other == null)
+ return false;
+
+ if (GetType () != other.GetType ())
+ return false;
+
+ return Name.Equals (other.Name);
}
public override int GetHashCode ()
@@ -78,20 +64,18 @@
return Name.GetHashCode ();
}
- [ConfigurationProperty ("name", Options =
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
+ [ConfigurationProperty ("name", IsRequired = true, IsKey =
true)]
public string Name {
- get { return (string)base [nameProp]; }
- internal set{ base [nameProp] = value; }
+ get { return (string)base ["name"]; }
+ internal set { base ["name"] = value; }
}
[ConfigurationProperty ("", Options =
ConfigurationPropertyOptions.IsDefaultCollection)]
+ //[ConfigurationProperty ("", IsDefaultCollection = true)]
+ [ConfigurationCollection (typeof
(ProfilePropertySettingsCollection), AddItemName = "add", ClearItemsName =
"clear")]
public ProfilePropertySettingsCollection PropertySettings {
- get { return (ProfilePropertySettingsCollection) base
[propertySettingsProp]; }
+ get { return (ProfilePropertySettingsCollection) base
[""]; }
}
-
- protected override ConfigurationPropertyCollection Properties {
- get { return properties; }
- }
}
}
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettingsCollection.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettingsCollection.cs
2006-11-05 14:09:18 UTC (rev 67376)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileGroupSettingsCollection.cs
2006-11-05 14:15:01 UTC (rev 67377)
@@ -35,20 +35,8 @@
namespace System.Web.Configuration
{
- [ConfigurationCollection (typeof (ProfileGroupSettings), AddItemName =
"group", CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class ProfileGroupSettingsCollection :
ConfigurationElementCollection
{
- static ConfigurationPropertyCollection properties;
-
- static ProfileGroupSettingsCollection ()
- {
- properties = new ConfigurationPropertyCollection ();
- }
-
- public ProfileGroupSettingsCollection ()
- {
- }
-
public void Add (ProfileGroupSettings group)
{
BaseAdd (group);
@@ -59,6 +47,11 @@
BaseClear ();
}
+ public override ConfigurationElementCollectionType
CollectionType
+ {
+ get { return
ConfigurationElementCollectionType.AddRemoveClearMap; }
+ }
+
protected override ConfigurationElement CreateNewElement ()
{
return new ProfileGroupSettings ();
@@ -76,7 +69,7 @@
protected override object GetElementKey (ConfigurationElement
element)
{
- return ((ProfileGroupSettings)element).Name;
+ return ((ProfileGroupSettings) element).Name;
}
public string GetKey (int index)
@@ -89,12 +82,6 @@
return BaseIndexOf (group);
}
- [MonoTODO]
- protected override bool IsModified ()
- {
- throw new NotImplementedException ();
- }
-
public void Remove (string name)
{
BaseRemove (name);
@@ -105,12 +92,6 @@
BaseRemoveAt (index);
}
- [MonoTODO]
- protected override void ResetModified ()
- {
- base.ResetModified ();
- }
-
public void Set (ProfileGroupSettings group)
{
ProfileGroupSettings existing = Get (group.Name);
@@ -125,19 +106,6 @@
}
}
- public string[ ] AllKeys {
- get {
- string[] keys = new string[Count];
- for (int i = 0; i < Count; i ++)
- keys[i] = this[i].Name;
- return keys;
- }
- }
-
- protected override ConfigurationPropertyCollection Properties {
- get { return properties; }
- }
-
public ProfileGroupSettings this[int index] {
get { return Get (index); }
set { if (BaseGet (index) != null) BaseRemoveAt
(index); BaseAdd (index, value); }
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfilePropertySettingsCollection.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfilePropertySettingsCollection.cs
2006-11-05 14:09:18 UTC (rev 67376)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfilePropertySettingsCollection.cs
2006-11-05 14:15:01 UTC (rev 67377)
@@ -36,20 +36,8 @@
namespace System.Web.Configuration
{
- [ConfigurationCollection (typeof (ProfilePropertySettings),
CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public class ProfilePropertySettingsCollection :
ConfigurationElementCollection
{
- static ConfigurationPropertyCollection properties;
-
- static ProfilePropertySettingsCollection ()
- {
- properties = new ConfigurationPropertyCollection ();
- }
-
- public ProfilePropertySettingsCollection ()
- {
- }
-
public void Add (ProfilePropertySettings propertySettings)
{
BaseAdd (propertySettings);
@@ -60,6 +48,11 @@
BaseClear ();
}
+ public override ConfigurationElementCollectionType
CollectionType
+ {
+ get { return
ConfigurationElementCollectionType.AddRemoveClearMap; }
+ }
+
protected override ConfigurationElement CreateNewElement ()
{
return new ProfilePropertySettings ();
@@ -94,12 +87,6 @@
return BaseIndexOf (propertySettings);
}
- [MonoTODO]
- protected override bool OnDeserializeUnrecognizedElement
(string elementName, XmlReader reader)
- {
- throw new NotImplementedException ();
- }
-
public void Remove (string name)
{
BaseRemove (name);
@@ -133,30 +120,22 @@
}
}
- [MonoTODO]
protected virtual bool AllowClear {
get {
- throw new NotImplementedException ();
+ return false;
}
}
- protected override ConfigurationPropertyCollection Properties {
- get { return properties; }
- }
-
public ProfilePropertySettings this[int index] {
get { return Get (index); }
set { if (Get (index) != null) BaseRemoveAt (index);
BaseAdd (index, value); }
}
- public new ProfilePropertySettings this[string name] {
- get { return Get (name); }
- }
-
protected override bool ThrowOnDuplicate {
- get { return false; }
+ get {
+ return true;
+ }
}
-
}
}
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileSection.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileSection.cs
2006-11-05 14:09:18 UTC (rev 67376)
+++ trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProfileSection.cs
2006-11-05 14:15:01 UTC (rev 67377)
@@ -48,10 +48,11 @@
static ProfileSection ()
{
autoSaveEnabledProp = new ConfigurationProperty
("automaticSaveEnabled", typeof (bool), true);
- defaultProviderProp = new ConfigurationProperty
("defaultProviderProp", typeof (string), "AspNetSqlProfileProvider");
+ defaultProviderProp = new ConfigurationProperty
("defaultProvider", typeof (string), "AspNetSqlProfileProvider");
inheritsProp = new ConfigurationProperty
("inheritsProps", typeof (string), "");
- propertySettingsProp = new ConfigurationProperty
("propertiesProp", typeof (RootProfilePropertySettingsCollection), null);
+ propertySettingsProp = new ConfigurationProperty
("properties", typeof (RootProfilePropertySettingsCollection), null);
providersProp = new ConfigurationProperty ("providers",
typeof (ProviderSettingsCollection), null);
+ enabledProp = new ConfigurationProperty ("enabled",
typeof (bool), false);
properties = new ConfigurationPropertyCollection ();
properties.Add (autoSaveEnabledProp);
@@ -59,6 +60,7 @@
properties.Add (inheritsProp);
properties.Add (propertySettingsProp);
properties.Add (providersProp);
+ properties.Add (enabledProp);
}
public ProfileSection ()
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/RootProfilePropertySettingsCollection.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/RootProfilePropertySettingsCollection.cs
2006-11-05 14:09:18 UTC (rev 67376)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/RootProfilePropertySettingsCollection.cs
2006-11-05 14:15:01 UTC (rev 67377)
@@ -36,96 +36,56 @@
namespace System.Web.Configuration
{
- [ConfigurationCollection (typeof (ProfilePropertySettings),
CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class RootProfilePropertySettingsCollection :
ProfilePropertySettingsCollection
{
- static ConfigurationPropertyCollection properties;
- static ConfigurationProperty groupSettingsProp;
-
- static RootProfilePropertySettingsCollection ()
+ protected override ConfigurationElement CreateNewElement ()
{
- groupSettingsProp = new ConfigurationProperty ("group",
typeof (ProfileGroupSettingsCollection), null);
-
- properties = new ConfigurationPropertyCollection ();
- properties.Add (groupSettingsProp);
+ return new ProfilePropertySettings ();
}
- public RootProfilePropertySettingsCollection ()
+ protected override Object GetElementKey (ConfigurationElement
element)
{
+ return ((ProfilePropertySettings) element).Name;
}
- [MonoTODO]
- public override bool Equals (object
rootProfilePropertySettingsCollection)
+ public override ConfigurationElementCollectionType
CollectionType
{
- throw new NotImplementedException ();
+ get { return
ConfigurationElementCollectionType.AddRemoveClearMap; }
}
-
- [MonoTODO]
- public override int GetHashCode ()
+
+ public override bool Equals (object obj)
{
- throw new NotImplementedException ();
- }
+ RootProfilePropertySettingsCollection col = obj as
RootProfilePropertySettingsCollection;
+ if (col == null)
+ return false;
- [MonoTODO]
- protected override bool IsModified ()
- {
- return base.IsModified ();
- }
+ if (GetType () != col.GetType ())
+ return false;
- [MonoTODO]
- protected override bool OnDeserializeUnrecognizedElement
(string elementName, XmlReader reader)
- {
- throw new NotImplementedException ();
- }
+ if (Count != col.Count)
+ return false;
- [MonoTODO]
- protected override void Reset (ConfigurationElement
parentElement)
- {
- base.Reset (parentElement);
+ for (int n = 0; n < Count; n++) {
+ if (!BaseGet (n).Equals (col.BaseGet (n)))
+ return false;
+ }
+ return true;
}
- [MonoTODO]
- protected override void ResetModified ()
+ public override int GetHashCode ()
{
- base.ResetModified ();
+ int code = 0;
+ for (int n = 0; n < Count; n++)
+ code += BaseGet (n).GetHashCode ();
+ return code;
}
- [MonoTODO]
- protected override bool SerializeElement (XmlWriter writer,
bool serializeCollectionKey)
- {
- bool ret = base.SerializeElement (writer,
serializeCollectionKey);
-
- /* XXX more here? .. */
-
- return ret;
- }
-
- [MonoTODO]
- protected override void Unmerge (ConfigurationElement
sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode
saveMode)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override bool AllowClear {
- get { throw new NotImplementedException (); }
- }
-
- [ConfigurationProperty ("group")]
+ [ConfigurationProperty ("", IsDefaultCollection = true)]
+ [ConfigurationCollection (typeof
(ProfileGroupSettingsCollection), AddItemName = "group")]
public ProfileGroupSettingsCollection GroupSettings {
- get { return (ProfileGroupSettingsCollection) base
[groupSettingsProp]; }
+ get { return (ProfileGroupSettingsCollection) base
[""]; }
}
-
- protected override ConfigurationPropertyCollection Properties {
- get { return properties; }
- }
-
- [MonoTODO]
- protected override bool ThrowOnDuplicate {
- get { throw new NotImplementedException (); }
- }
}
-
}
#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches