2010-05-14 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / DataBindingHandlerAttribute.cs
index 6a73d95ec4ea66f080c687e31484ef872e29f91b..d5ff98455d0e97190fa42d6aa68cd47eb70f751b 100644 (file)
@@ -1,4 +1,9 @@
-
+//
+// System.Web.UI.WebControls.DataBindingHandlerAttribute class
+//
+// Author: Duncan Mak (duncan@novell.com)
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-/**\r
- * Namespace: System.Web.UI\r
- * Class:     DataBindingHandlerAttribute\r
- *\r
- * Author:  Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status:  100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.Reflection;\r
-\r
-namespace System.Web.UI\r
-{\r
-       [AttributeUsage(AttributeTargets.Class)]\r
-       public sealed class DataBindingHandlerAttribute : Attribute\r
-       {\r
-               public static readonly DataBindingHandlerAttribute Default;\r
-\r
-               private string handlerTypeName;\r
-\r
-               public DataBindingHandlerAttribute()\r
-               {\r
-                       handlerTypeName = String.Empty;\r
-               }\r
-\r
-               public DataBindingHandlerAttribute(string typeName)\r
-               {\r
-                       handlerTypeName = typeName;\r
-               }\r
-\r
-               public DataBindingHandlerAttribute(Type type)\r
-               {\r
-                       handlerTypeName = type.AssemblyQualifiedName;\r
-               }\r
-\r
-               public string HandlerTypeName\r
-               {\r
-                       get\r
-                       {\r
-                               return handlerTypeName;\r
-                       }\r
-               }\r
-       }\r
-}\r
+
+using System.Security.Permissions;
+
+namespace System.Web.UI {
+
+       // CAS - no InheritanceDemand here as the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       // attributes
+       [AttributeUsage (AttributeTargets.Class)]
+       public sealed class DataBindingHandlerAttribute : Attribute
+       {
+               string name;            
+
+               static DataBindingHandlerAttribute ()
+               {
+                       Default = new DataBindingHandlerAttribute ();
+               }
+
+               public DataBindingHandlerAttribute ()
+                       : this (String.Empty)
+               {
+               }
+
+               public DataBindingHandlerAttribute (string name)
+               {
+                       this.name = (name != null) ? name : String.Empty;
+               }
+
+               public DataBindingHandlerAttribute (Type type)
+               {
+                       this.name = type.AssemblyQualifiedName;
+               }
+
+               public static readonly DataBindingHandlerAttribute Default;
+
+               public override bool Equals (object obj) 
+               {
+                       DataBindingHandlerAttribute other = obj as DataBindingHandlerAttribute;
+                       if (other == null) {
+                               return false;
+                       }
+
+                       return HandlerTypeName.Equals (other.HandlerTypeName);
+               }
+
+               public override int GetHashCode () 
+               {
+                       return HandlerTypeName.GetHashCode ();
+               }
+
+               public string HandlerTypeName {
+                       get { return name; }
+               }
+       }
+}