2005-11-23 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / TraceSection.cs
1 //
2 // System.Web.Configuration.TraceSection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (C) 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
32 using System;
33 using System.ComponentModel;
34 using System.Configuration;
35
36 #if NET_2_0
37
38 namespace System.Web.Configuration {
39
40         public sealed class TraceSection : ConfigurationSection
41         {
42                 static ConfigurationProperty enabledProp;
43                 static ConfigurationProperty localOnlyProp;
44                 static ConfigurationProperty mostRecentProp;
45                 static ConfigurationProperty pageOutputProp;
46                 static ConfigurationProperty requestLimitProp;
47                 static ConfigurationProperty traceModeProp;
48                 static ConfigurationProperty writeToDiagnosticsTraceProp;
49                 static ConfigurationPropertyCollection properties;
50
51                 static TraceSection ()
52                 {
53                         enabledProp = new ConfigurationProperty ("enabled", typeof (bool), false);
54                         localOnlyProp = new ConfigurationProperty ("localOnly", typeof (bool), true);
55                         mostRecentProp = new ConfigurationProperty ("mostRecent", typeof (bool), false);
56                         pageOutputProp = new ConfigurationProperty ("pageOutput", typeof (bool), false);
57                         requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), 10,
58                                                                       TypeDescriptor.GetConverter (typeof (int)),
59                                                                       PropertyHelper.IntFromZeroToMaxValidator,
60                                                                       ConfigurationPropertyOptions.None);
61                         traceModeProp = new ConfigurationProperty ("traceMode", typeof (TraceDisplayMode), TraceDisplayMode.SortByTime);
62                         writeToDiagnosticsTraceProp = new ConfigurationProperty ("writeToDiagnosticsTrace", typeof (bool), false);
63                         properties = new ConfigurationPropertyCollection ();
64
65                         properties.Add (enabledProp);
66                         properties.Add (localOnlyProp);
67                         properties.Add (mostRecentProp);
68                         properties.Add (pageOutputProp);
69                         properties.Add (requestLimitProp);
70                         properties.Add (traceModeProp);
71                         properties.Add (writeToDiagnosticsTraceProp);
72                 }
73
74                 [ConfigurationProperty ("enabled", DefaultValue = "False")]
75                 public bool Enabled {
76                         get { return (bool) base [enabledProp];}
77                         set { base[enabledProp] = value; }
78                 }
79
80                 [ConfigurationProperty ("localOnly", DefaultValue = "True")]
81                 public bool LocalOnly {
82                         get { return (bool) base [localOnlyProp];}
83                         set { base[localOnlyProp] = value; }
84                 }
85
86                 [ConfigurationProperty ("mostRecent", DefaultValue = "False")]
87                 public bool MostRecent {
88                         get { return (bool) base [mostRecentProp];}
89                         set { base[mostRecentProp] = value; }
90                 }
91
92                 [ConfigurationProperty ("pageOutput", DefaultValue = "False")]
93                 public bool PageOutput {
94                         get { return (bool) base [pageOutputProp];}
95                         set { base[pageOutputProp] = value; }
96                 }
97
98                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
99                 [ConfigurationProperty ("requestLimit", DefaultValue = "10")]
100                 public int RequestLimit {
101                         get { return (int) base [requestLimitProp];}
102                         set { base[requestLimitProp] = value; }
103                 }
104
105                 [ConfigurationProperty ("traceMode", DefaultValue = "SortByTime")]
106                 public TraceDisplayMode TraceMode {
107                         get { return (TraceDisplayMode) base [traceModeProp];}
108                         set { base[traceModeProp] = value; }
109                 }
110
111                 [ConfigurationProperty ("writeToDiagnosticsTrace", DefaultValue = "False")]
112                 public bool WriteToDiagnosticsTrace {
113                         get { return (bool) base [writeToDiagnosticsTraceProp];}
114                         set { base[writeToDiagnosticsTraceProp] = value; }
115                 }
116
117                 protected override ConfigurationPropertyCollection Properties {
118                         get { return properties; }
119                 }
120
121         }
122
123 }
124
125 #endif
126