2005-11-18 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / OutputCacheProfile.cs
1 //
2 // System.Web.Configuration.OutputCacheProfile
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 using System;
32 using System.ComponentModel;
33 using System.Configuration;
34 using System.Web.UI;
35
36 #if NET_2_0
37
38 namespace System.Web.Configuration {
39
40         public sealed class OutputCacheProfile : ConfigurationElement
41         {
42                 static ConfigurationProperty durationProp;
43                 static ConfigurationProperty enabledProp;
44                 static ConfigurationProperty locationProp;
45                 static ConfigurationProperty nameProp;
46                 static ConfigurationProperty noStoreProp;
47                 static ConfigurationProperty sqlDependencyProp;
48                 static ConfigurationProperty varyByControlProp;
49                 static ConfigurationProperty varyByCustomProp;
50                 static ConfigurationProperty varyByHeaderProp;
51                 static ConfigurationProperty varyByParamProp;
52                 static ConfigurationPropertyCollection properties;
53
54                 static OutputCacheProfile ()
55                 {
56                         durationProp = new ConfigurationProperty ("duration", typeof (int), -1);
57                         enabledProp = new ConfigurationProperty ("enabled", typeof (bool), true);
58                         locationProp = new ConfigurationProperty ("location", typeof (OutputCacheLocation));
59                         nameProp = new ConfigurationProperty ("name", typeof (string), "", ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
60                         noStoreProp = new ConfigurationProperty ("noStore", typeof (bool), false);
61                         sqlDependencyProp = new ConfigurationProperty ("sqlDependency", typeof (string));
62                         varyByControlProp = new ConfigurationProperty ("varyByControl", typeof (string));
63                         varyByCustomProp = new ConfigurationProperty ("varyByCustom", typeof (string));
64                         varyByHeaderProp = new ConfigurationProperty ("varyByHeader", typeof (string));
65                         varyByParamProp = new ConfigurationProperty ("varyByParam", typeof (string));
66                         properties = new ConfigurationPropertyCollection ();
67
68                         properties.Add (durationProp);
69                         properties.Add (enabledProp);
70                         properties.Add (locationProp);
71                         properties.Add (nameProp);
72                         properties.Add (noStoreProp);
73                         properties.Add (sqlDependencyProp);
74                         properties.Add (varyByControlProp);
75                         properties.Add (varyByCustomProp);
76                         properties.Add (varyByHeaderProp);
77                         properties.Add (varyByParamProp);
78                 }
79
80                 public OutputCacheProfile (string name)
81                 {
82                         this.Name = name;
83                 }
84
85                 [ConfigurationProperty ("duration", DefaultValue = "-1")]
86                 public int Duration {
87                         get { return (int) base [durationProp];}
88                         set { base[durationProp] = value; }
89                 }
90
91                 [ConfigurationProperty ("enabled", DefaultValue = "True")]
92                 public bool Enabled {
93                         get { return (bool) base [enabledProp];}
94                         set { base[enabledProp] = value; }
95                 }
96
97                 [ConfigurationProperty ("location")]
98                 public OutputCacheLocation Location {
99                         get { return (OutputCacheLocation) base [locationProp];}
100                         set { base[locationProp] = value; }
101                 }
102
103                 [StringValidator (MinLength = 1)]
104                 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
105                 [ConfigurationProperty ("name", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
106                 public string Name {
107                         get { return (string) base [nameProp];}
108                         set { base[nameProp] = value; }
109                 }
110
111                 [ConfigurationProperty ("noStore", DefaultValue = "False")]
112                 public bool NoStore {
113                         get { return (bool) base [noStoreProp];}
114                         set { base[noStoreProp] = value; }
115                 }
116
117                 [ConfigurationProperty ("sqlDependency")]
118                 public string SqlDependency {
119                         get { return (string) base [sqlDependencyProp];}
120                         set { base[sqlDependencyProp] = value; }
121                 }
122
123                 [ConfigurationProperty ("varyByControl")]
124                 public string VaryByControl {
125                         get { return (string) base [varyByControlProp];}
126                         set { base[varyByControlProp] = value; }
127                 }
128
129                 [ConfigurationProperty ("varyByCustom")]
130                 public string VaryByCustom {
131                         get { return (string) base [varyByCustomProp];}
132                         set { base[varyByCustomProp] = value; }
133                 }
134
135                 [ConfigurationProperty ("varyByHeader")]
136                 public string VaryByHeader {
137                         get { return (string) base [varyByHeaderProp];}
138                         set { base[varyByHeaderProp] = value; }
139                 }
140
141                 [ConfigurationProperty ("varyByParam")]
142                 public string VaryByParam {
143                         get { return (string) base [varyByParamProp];}
144                         set { base[varyByParamProp] = value; }
145                 }
146
147                 protected override ConfigurationPropertyCollection Properties {
148                         get { return properties; }
149                 }
150
151         }
152
153 }
154
155 #endif
156