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
;
40 namespace System
.Web
.Services
.Configuration
{
42 public sealed class SoapExtensionTypeElement
: ConfigurationElement
44 static ConfigurationProperty groupProp
;
45 static ConfigurationProperty priorityProp
;
46 static ConfigurationProperty typeProp
;
47 static ConfigurationPropertyCollection properties
;
49 static SoapExtensionTypeElement ()
51 groupProp
= new ConfigurationProperty ("group", typeof (PriorityGroup
), PriorityGroup
.Low
, ConfigurationPropertyOptions
.IsKey
);
52 priorityProp
= new ConfigurationProperty ("priority", typeof (int), 0,
53 new Int32Converter(), new IntegerValidator (0, Int32
.MaxValue
),
54 ConfigurationPropertyOptions
.IsKey
);
55 typeProp
= new ConfigurationProperty ("type", typeof (Type
), null,
56 new TypeTypeConverter (),
57 null, ConfigurationPropertyOptions
.IsKey
);
58 properties
= new ConfigurationPropertyCollection ();
60 properties
.Add (groupProp
);
61 properties
.Add (priorityProp
);
62 properties
.Add (typeProp
);
66 public SoapExtensionTypeElement (Type type
, int priority
, PriorityGroup
group)
69 this.Priority
= priority
;
74 public SoapExtensionTypeElement (string type
, int priority
, PriorityGroup
group)
75 : this (Type
.GetType (type
), priority
, group)
79 public SoapExtensionTypeElement ()
83 [ConfigurationProperty ("group", DefaultValue
= PriorityGroup
.Low
, Options
= ConfigurationPropertyOptions
.IsKey
)]
84 public PriorityGroup Group
{
85 get { return (PriorityGroup) base [groupProp];}
86 set { base[groupProp] = value; }
89 [IntegerValidator (MaxValue
= int.MaxValue
)]
90 [ConfigurationProperty ("priority", DefaultValue
= 0, Options
= ConfigurationPropertyOptions
.IsKey
)]
92 get { return (int) base [priorityProp];}
93 set { base[priorityProp] = value; }
96 [TypeConverter (typeof (TypeTypeConverter
))]
97 [ConfigurationProperty ("type", Options
= ConfigurationPropertyOptions
.IsKey
)]
99 get { return (Type) base [typeProp];}
100 set { base[typeProp] = value; }
103 internal object GetKey ()
105 return String
.Format ("{0}-{0}-{0}", Type
, Priority
, Group
);
108 protected override ConfigurationPropertyCollection Properties
{
109 get { return properties; }