2 // System.Web.Configuration.OutputCacheProfile
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
32 using System.ComponentModel;
33 using System.Configuration;
38 namespace System.Web.Configuration {
40 public sealed class OutputCacheProfile : ConfigurationElement
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;
54 static OutputCacheProfile ()
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 ();
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);
80 public OutputCacheProfile (string name)
85 [ConfigurationProperty ("duration", DefaultValue = "-1")]
87 get { return (int) base [durationProp];}
88 set { base[durationProp] = value; }
91 [ConfigurationProperty ("enabled", DefaultValue = "True")]
93 get { return (bool) base [enabledProp];}
94 set { base[enabledProp] = value; }
97 [ConfigurationProperty ("location")]
98 public OutputCacheLocation Location {
99 get { return (OutputCacheLocation) base [locationProp];}
100 set { base[locationProp] = value; }
103 [StringValidator (MinLength = 1)]
104 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
105 [ConfigurationProperty ("name", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
107 get { return (string) base [nameProp];}
108 set { base[nameProp] = value; }
111 [ConfigurationProperty ("noStore", DefaultValue = "False")]
112 public bool NoStore {
113 get { return (bool) base [noStoreProp];}
114 set { base[noStoreProp] = value; }
117 [ConfigurationProperty ("sqlDependency")]
118 public string SqlDependency {
119 get { return (string) base [sqlDependencyProp];}
120 set { base[sqlDependencyProp] = value; }
123 [ConfigurationProperty ("varyByControl")]
124 public string VaryByControl {
125 get { return (string) base [varyByControlProp];}
126 set { base[varyByControlProp] = value; }
129 [ConfigurationProperty ("varyByCustom")]
130 public string VaryByCustom {
131 get { return (string) base [varyByCustomProp];}
132 set { base[varyByCustomProp] = value; }
135 [ConfigurationProperty ("varyByHeader")]
136 public string VaryByHeader {
137 get { return (string) base [varyByHeaderProp];}
138 set { base[varyByHeaderProp] = value; }
141 [ConfigurationProperty ("varyByParam")]
142 public string VaryByParam {
143 get { return (string) base [varyByParamProp];}
144 set { base[varyByParamProp] = value; }
147 protected override ConfigurationPropertyCollection Properties {
148 get { return properties; }