Author: toshok
Date: 2006-01-16 15:05:59 -0500 (Mon, 16 Jan 2006)
New Revision: 55649
Modified:
trunk/mcs/class/System/System.Configuration/ChangeLog
trunk/mcs/class/System/System.Configuration/ConfigurationSettings.cs
Log:
2006-01-16 Chris Toshok <[EMAIL PROTECTED]>
* ConfigurationSettings.cs (AppSettings): move back to a 1.x
strategy in the 2.0 case. That is, don't hardcode the reference
to ConfigurationManager.AppSettings (yet). Eventually we can move
back to this code, once ConfigurationManager supports reading
web.config for settings.
Modified: trunk/mcs/class/System/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Configuration/ChangeLog 2006-01-16
19:24:18 UTC (rev 55648)
+++ trunk/mcs/class/System/System.Configuration/ChangeLog 2006-01-16
20:05:59 UTC (rev 55649)
@@ -1,3 +1,11 @@
+2006-01-16 Chris Toshok <[EMAIL PROTECTED]>
+
+ * ConfigurationSettings.cs (AppSettings): move back to a 1.x
+ strategy in the 2.0 case. That is, don't hardcode the reference
+ to ConfigurationManager.AppSettings (yet). Eventually we can move
+ back to this code, once ConfigurationManager supports reading
+ web.config for settings.
+
2006-01-03 Chris Toshok <[EMAIL PROTECTED]>
* ConfigurationSettings.cs (GetConfig): be nice to people using
Modified: trunk/mcs/class/System/System.Configuration/ConfigurationSettings.cs
===================================================================
--- trunk/mcs/class/System/System.Configuration/ConfigurationSettings.cs
2006-01-16 19:24:18 UTC (rev 55648)
+++ trunk/mcs/class/System/System.Configuration/ConfigurationSettings.cs
2006-01-16 20:05:59 UTC (rev 55649)
@@ -65,12 +65,28 @@
#if NET_2_0
[Obsolete ("This property is obsolete. Please use
System.Configuration.ConfigurationManager.AppSettings")]
#endif
+#if NET_2_0 && CONFIGURATION_2_0
+ static NameValueCollection appSettingsCol;
+#endif
public static NameValueCollection AppSettings
{
get {
#if NET_2_0 && CONFIGURATION_2_0
#if CONFIGURATION_DEP
- return ConfigurationManager.AppSettings;
+ lock (lockobj) {
+ if (appSettingsCol == null) {
+ AppSettingsSection appSettings
= (AppSettingsSection)GetConfig ("appSettings");
+
+ appSettingsCol = new
NameValueCollection ();
+
+ foreach (string key in
appSettings.Settings.AllKeys) {
+
KeyValueConfigurationElement ele = appSettings.Settings[key];
+ appSettingsCol.Add
(ele.Key, ele.Value);
+ }
+ }
+ }
+
+ return appSettingsCol;
#else
return null;
#endif
@@ -93,6 +109,9 @@
lock (lockobj) {
IConfigurationSystem old = config;
config = newSystem;
+#if NET_2_0 && CONFIGURATION_2_0
+ appSettingsCol = null;
+#endif
return old;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches