2 // System.Web.Services.Configuration.SoapExtensionTypeElement
5 // Chris Toshok (toshok@ximian.com)
6 // Atsushi Enomoto (atsushi@ximian.com)
8 // (C) 2006-2007 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Configuration;
34 using System.ComponentModel;
35 using System.Globalization;
36 using System.Security.Permissions;
39 namespace System.Web.Services.Configuration {
41 public sealed class SoapExtensionTypeElement : ConfigurationElement
43 static ConfigurationProperty groupProp;
44 static ConfigurationProperty priorityProp;
45 static ConfigurationProperty typeProp;
46 static ConfigurationPropertyCollection properties;
48 static SoapExtensionTypeElement ()
50 groupProp = new ConfigurationProperty ("group", typeof (PriorityGroup), PriorityGroup.Low, ConfigurationPropertyOptions.IsKey);
51 priorityProp = new ConfigurationProperty ("priority", typeof (int), 0,
52 new Int32Converter(), new IntegerValidator (0, Int32.MaxValue),
53 ConfigurationPropertyOptions.IsKey);
54 typeProp = new ConfigurationProperty ("type", typeof (Type), null,
55 new TypeTypeConverter (),
56 null, ConfigurationPropertyOptions.IsKey);
57 properties = new ConfigurationPropertyCollection ();
59 properties.Add (groupProp);
60 properties.Add (priorityProp);
61 properties.Add (typeProp);
65 public SoapExtensionTypeElement (Type type, int priority, PriorityGroup group)
68 this.Priority = priority;
73 public SoapExtensionTypeElement (string type, int priority, PriorityGroup group)
74 : this (Type.GetType (type), priority, group)
78 public SoapExtensionTypeElement ()
82 [ConfigurationProperty ("group", DefaultValue = PriorityGroup.Low, Options = ConfigurationPropertyOptions.IsKey)]
83 public PriorityGroup Group {
84 get { return (PriorityGroup) base [groupProp];}
85 set { base[groupProp] = value; }
88 [IntegerValidator (MaxValue = int.MaxValue)]
89 [ConfigurationProperty ("priority", DefaultValue = 0, Options = ConfigurationPropertyOptions.IsKey)]
91 get { return (int) base [priorityProp];}
92 set { base[priorityProp] = value; }
95 [TypeConverter (typeof (TypeTypeConverter))]
96 [ConfigurationProperty ("type", Options = ConfigurationPropertyOptions.IsKey)]
98 get { return (Type) base [typeProp];}
99 set { base[typeProp] = value; }
102 internal object GetKey ()
104 return String.Format ("{0}-{0}-{0}", Type, Priority, Group);
107 protected override ConfigurationPropertyCollection Properties {
108 get { return properties; }