merge -r 61110:61111
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / SqlCacheDependencyDatabase.cs
index d8e3421b92da501c609d5a12f316167c06f2e56e..c10c9f51a7eb32ff417d9e442976b12a51dfc057 100644 (file)
@@ -29,6 +29,7 @@
 //
 
 using System;
+using System.ComponentModel;
 using System.Configuration;
 
 #if NET_2_0
@@ -42,19 +43,29 @@ namespace System.Web.Configuration {
                static ConfigurationProperty pollTimeProp;
                static ConfigurationPropertyCollection properties;
 
+               static ConfigurationElementProperty elementProperty;
+
                static SqlCacheDependencyDatabase ()
                {
-                       connectionStringNameProp = new ConfigurationProperty ("connectionStringName", typeof (string), null, ConfigurationPropertyOptions.IsRequired);
-                       nameProp = new ConfigurationProperty ("name", typeof (string), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
+                       connectionStringNameProp = new ConfigurationProperty ("connectionStringName", typeof (string), null,
+                                                                             TypeDescriptor.GetConverter (typeof (string)),
+                                                                             PropertyHelper.NonEmptyStringValidator,
+                                                                             ConfigurationPropertyOptions.IsRequired);
+                       nameProp = new ConfigurationProperty ("name", typeof (string), null,
+                                                             TypeDescriptor.GetConverter (typeof (string)),
+                                                             PropertyHelper.NonEmptyStringValidator,
+                                                             ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
                        pollTimeProp = new ConfigurationProperty ("pollTime", typeof (int), 60000);
                        properties = new ConfigurationPropertyCollection ();
 
                        properties.Add (connectionStringNameProp);
                        properties.Add (nameProp);
                        properties.Add (pollTimeProp);
+
+                       elementProperty = new ConfigurationElementProperty (new CallbackValidator (typeof (SqlCacheDependencyDatabase), ValidateElement));
                }
 
-               public SqlCacheDependencyDatabase ()
+               internal SqlCacheDependencyDatabase ()
                {
                }
 
@@ -71,6 +82,16 @@ namespace System.Web.Configuration {
                        this.PollTime = pollTime;
                }
 
+               [MonoTODO]
+               static void ValidateElement (object o)
+               {
+                       /* XXX do some sort of element validation here? */
+               }
+
+               protected override ConfigurationElementProperty ElementProperty {
+                       get { return elementProperty; }
+               }
+
                [StringValidator (MinLength = 1)]
                [ConfigurationProperty ("connectionStringName", Options = ConfigurationPropertyOptions.IsRequired)]
                public string ConnectionStringName {
@@ -78,12 +99,6 @@ namespace System.Web.Configuration {
                        set { base[connectionStringNameProp] = value; }
                }
 
-#if notyet
-               protected override ConfigurationElementProperty ElementProperty {
-                       get { throw new NotImplementedException (); }
-               }
-#endif
-
                [StringValidator (MinLength = 1)]
                [ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
                public string Name {