2006-06-08 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / TagPrefixInfo.cs
index c8970ffb94845db31abd4dc648cb6dd21c93c807..ef417df2456742a201966ed63e283171742bf469 100644 (file)
@@ -47,9 +47,14 @@ namespace System.Web.Configuration
                static ConfigurationProperty tagNameProp;
                static ConfigurationProperty sourceProp;
 
+               static ConfigurationElementProperty elementProperty;
+
                static TagPrefixInfo ()
                {
-                       tagPrefixProp = new ConfigurationProperty ("tagPrefix", typeof (string), "/", ConfigurationPropertyOptions.IsRequired);
+                       tagPrefixProp = new ConfigurationProperty ("tagPrefix", typeof (string), "/",
+                                                                  TypeDescriptor.GetConverter (typeof (string)),
+                                                                  PropertyHelper.NonEmptyStringValidator,
+                                                                  ConfigurationPropertyOptions.IsRequired);
                        namespaceProp = new ConfigurationProperty ("namespace", typeof (string));
                        assemblyProp = new ConfigurationProperty ("assembly", typeof (string));
                        tagNameProp = new ConfigurationProperty ("tagName", typeof (string));
@@ -61,6 +66,12 @@ namespace System.Web.Configuration
                        properties.Add (assemblyProp);
                        properties.Add (tagNameProp);
                        properties.Add (sourceProp);
+
+                       elementProperty = new ConfigurationElementProperty (new CallbackValidator (typeof (TagPrefixInfo), ValidateElement));
+               }
+
+               internal TagPrefixInfo ()
+               {
                }
 
                public TagPrefixInfo (string tagPrefix, string nameSpace, string assembly, string tagName, string source)
@@ -73,15 +84,30 @@ namespace System.Web.Configuration
                }
 
                [MonoTODO]
+               static void ValidateElement (object o)
+               {
+                       /* XXX do some sort of element validation here? */
+               }
+
+               protected override ConfigurationElementProperty ElementProperty {
+                       get { return elementProperty; }
+               }
+
                public override bool Equals (object prefix)
                {
-                       return base.Equals (prefix);
+                       TagPrefixInfo info = prefix as TagPrefixInfo;
+                       if (info == null)
+                               return false;
+
+                       return (Namespace == info.Namespace
+                               && Source == info.Source
+                               && TagName == info.TagName
+                               && TagPrefix == info.TagPrefix);
                }
 
-               [MonoTODO]
                public override int GetHashCode ()
                {
-                       return base.GetHashCode ();
+                       return Namespace.GetHashCode() + Source.GetHashCode() + TagName.GetHashCode() + TagPrefix.GetHashCode();
                }
 
                [ConfigurationProperty ("assembly")]
@@ -90,13 +116,6 @@ namespace System.Web.Configuration
                        set { base[assemblyProp] = value; }
                }
 
-#if notyet
-               [MonoTODO]
-               protected override ConfigurationElementProperty ElementProperty {
-                       get { return base.ElementProperty; }
-               }
-#endif
-
                [ConfigurationProperty ("namespace")]
                public string Namespace {
                        get { return (string) base[namespaceProp]; }