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