* PagesConfigurationHandler.cs: Use enum for EnableSessionState.
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / SqlCacheDependencyDatabaseCollection.cs
index 0b62cfaf311926c34ffbfce13c080452ed463160..5ed6e3ade0bc5cf6db0505e912a0a8120916b3a4 100644 (file)
@@ -63,16 +63,17 @@ namespace System.Web.Configuration {
                        return new SqlCacheDependencyDatabase ();
                }
 
-               [MonoTODO]
                protected override object GetElementKey (ConfigurationElement element)
                {
-                       throw new NotImplementedException ();
+                       return ((SqlCacheDependencyDatabase)element).Name;
                }
 
-               [MonoTODO]
                public string GetKey (int index)
                {
-                       throw new NotImplementedException ();
+                       SqlCacheDependencyDatabase db = Get (index);
+                       if (db == null)
+                               return null;
+                       return db.Name;
                }
 
                public void Remove (string name)
@@ -85,21 +86,32 @@ namespace System.Web.Configuration {
                        BaseRemoveAt (index);
                }
 
-               [MonoTODO]
                public void Set (SqlCacheDependencyDatabase user)
                {
-                       throw new NotImplementedException ();
+                       SqlCacheDependencyDatabase existing = Get (user.Name);
+
+                       if (existing == null) {
+                               Add (user);
+                       }
+                       else {
+                               int index = BaseIndexOf (existing);
+                               RemoveAt (index);
+                               BaseAdd (index, user);
+                       }
                }
 
-               [MonoTODO]
-               public String[] AllKeys {
-                       get { throw new NotImplementedException (); }
+               public string[] AllKeys {
+                       get {
+                               string[] keys = new string[Count];
+                               for (int i = 0; i < Count; i ++)
+                                       keys[i] = this[i].Name;
+                               return keys;
+                       }
                }
 
                public SqlCacheDependencyDatabase this [int index] {
                        get { return (SqlCacheDependencyDatabase) BaseGet (index); }
-                       [MonoTODO]
-                       set { throw new NotImplementedException (); }
+                       set { if (BaseGet (index) != null) BaseRemoveAt (index); BaseAdd (index, value); }
                }
 
                public new SqlCacheDependencyDatabase this [string name] {