Merge pull request #2080 from upsilon/fix-point-constructor
[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
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                                                                       TypeDescriptor.GetConverter (typeof (int)),
58                                                                       PropertyHelper.IntFromZeroToMaxValidator,
59                                                                       ConfigurationPropertyOptions.None);
60                         traceModeProp = new ConfigurationProperty ("traceMode", typeof (TraceDisplayMode), TraceDisplayMode.SortByTime,
61                                                                    new GenericEnumConverter (typeof (TraceDisplayMode)), null,
62                                                                    ConfigurationPropertyOptions.None);
63                         writeToDiagnosticsTraceProp = new ConfigurationProperty ("writeToDiagnosticsTrace", typeof (bool), false);
64                         properties = new ConfigurationPropertyCollection ();
65
66                         properties.Add (enabledProp);
67                         properties.Add (localOnlyProp);
68                         properties.Add (mostRecentProp);
69                         properties.Add (pageOutputProp);
70                         properties.Add (requestLimitProp);
71                         properties.Add (traceModeProp);
72                         properties.Add (writeToDiagnosticsTraceProp);
73                 }
74
75                 [ConfigurationProperty ("enabled", DefaultValue = "False")]
76                 public bool Enabled {
77                         get { return (bool) base [enabledProp];}
78                         set { base[enabledProp] = value; }
79                 }
80
81                 [ConfigurationProperty ("localOnly", DefaultValue = "True")]
82                 public bool LocalOnly {
83                         get { return (bool) base [localOnlyProp];}
84                         set { base[localOnlyProp] = value; }
85                 }
86
87                 [ConfigurationProperty ("mostRecent", DefaultValue = "False")]
88                 public bool MostRecent {
89                         get { return (bool) base [mostRecentProp];}
90                         set { base[mostRecentProp] = value; }
91                 }
92
93                 [ConfigurationProperty ("pageOutput", DefaultValue = "False")]
94                 public bool PageOutput {
95                         get { return (bool) base [pageOutputProp];}
96                         set { base[pageOutputProp] = value; }
97                 }
98
99                 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
100                 [ConfigurationProperty ("requestLimit", DefaultValue = "10")]
101                 public int RequestLimit {
102                         get { return (int) base [requestLimitProp];}
103                         set { base[requestLimitProp] = value; }
104                 }
105
106                 [ConfigurationProperty ("traceMode", DefaultValue = "SortByTime")]
107                 public TraceDisplayMode TraceMode {
108                         get { return (TraceDisplayMode) base [traceModeProp];}
109                         set { base[traceModeProp] = value; }
110                 }
111
112                 [ConfigurationProperty ("writeToDiagnosticsTrace", DefaultValue = "False")]
113                 public bool WriteToDiagnosticsTrace {
114                         get { return (bool) base [writeToDiagnosticsTraceProp];}
115                         set { base[writeToDiagnosticsTraceProp] = value; }
116                 }
117
118                 protected internal override ConfigurationPropertyCollection Properties {
119                         get { return properties; }
120                 }
121
122         }
123
124 }
125
126