2008-05-22 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / HostingEnvironmentSection.cs
1 //
2 // System.Web.Configuration.HostingEnvironmentSection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (c) Copyright 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.ComponentModel;
33 using System.Configuration;
34
35 #if NET_2_0
36
37 namespace System.Web.Configuration {
38
39         public sealed class HostingEnvironmentSection : ConfigurationSection
40         {
41                 static ConfigurationProperty idleTimeoutProp;
42                 static ConfigurationProperty shadowCopyBinAssembliesProp;
43                 static ConfigurationProperty shutdownTimeoutProp;
44                 static ConfigurationPropertyCollection properties;
45
46                 static HostingEnvironmentSection ()
47                 {
48                         idleTimeoutProp = new ConfigurationProperty ("idleTimeout", typeof (TimeSpan), TimeSpan.MaxValue,
49                                                                      PropertyHelper.TimeSpanMinutesOrInfiniteConverter,
50                                                                      PropertyHelper.PositiveTimeSpanValidator,
51                                                                      ConfigurationPropertyOptions.None);
52                         shadowCopyBinAssembliesProp = new ConfigurationProperty ("shadowCopyBinAssemblies", typeof (bool), true);
53                         shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (30),
54                                                                          PropertyHelper.TimeSpanSecondsConverter,
55                                                                          PropertyHelper.PositiveTimeSpanValidator,
56                                                                          ConfigurationPropertyOptions.None);
57                         properties = new ConfigurationPropertyCollection ();
58
59                         properties.Add (idleTimeoutProp);
60                         properties.Add (shadowCopyBinAssembliesProp);
61                         properties.Add (shutdownTimeoutProp);
62
63                 }
64
65                 [TypeConverter (typeof (TimeSpanMinutesOrInfiniteConverter))]
66                 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
67                 [ConfigurationProperty ("idleTimeout", DefaultValue = "10675199.02:48:05.4775807")]
68                 public TimeSpan IdleTimeout {
69                         get { return (TimeSpan) base [idleTimeoutProp];}
70                         set { base[idleTimeoutProp] = value; }
71                 }
72
73                 [ConfigurationProperty ("shadowCopyBinAssemblies", DefaultValue = "True")]
74                 public bool ShadowCopyBinAssemblies {
75                         get { return (bool) base [shadowCopyBinAssembliesProp];}
76                         set { base[shadowCopyBinAssembliesProp] = value; }
77                 }
78
79                 [TypeConverter (typeof (TimeSpanSecondsConverter))]
80                 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
81                 [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:00:30")]
82                 public TimeSpan ShutdownTimeout {
83                         get { return (TimeSpan) base [shutdownTimeoutProp];}
84                         set { base[shutdownTimeoutProp] = value; }
85                 }
86
87                 protected override ConfigurationPropertyCollection Properties {
88                         get { return properties; }
89                 }
90
91         }
92
93 }
94
95 #endif
96