2 // System.Web.Configuration.OutputCacheSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005-2010 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.Configuration;
34 namespace System.Web.Configuration
37 public sealed class OutputCacheSection : ConfigurationSection
39 static ConfigurationProperty enableFragmentCacheProp;
40 static ConfigurationProperty enableOutputCacheProp;
41 static ConfigurationProperty omitVaryStarProp;
42 static ConfigurationProperty sendCacheControlHeaderProp;
43 static ConfigurationProperty enableKernelCacheForVaryByStarProp;
45 static ConfigurationProperty providersProp;
46 static ConfigurationProperty defaultProviderNameProp;
49 static ConfigurationPropertyCollection properties;
51 static OutputCacheSection ()
53 enableFragmentCacheProp = new ConfigurationProperty ("enableFragmentCache", typeof (bool), true);
54 enableOutputCacheProp = new ConfigurationProperty ("enableOutputCache", typeof (bool), true);
55 omitVaryStarProp = new ConfigurationProperty ("omitVaryStar", typeof (bool), false);
56 sendCacheControlHeaderProp = new ConfigurationProperty ("sendCacheControlHeader", typeof (bool), true);
57 enableKernelCacheForVaryByStarProp = new ConfigurationProperty ("enableKernelCacheForVaryByStar", typeof (bool), false);
59 providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection));
60 defaultProviderNameProp = new ConfigurationProperty ("defaultProvider", typeof (string), "AspNetInternalProvider");
63 properties = new ConfigurationPropertyCollection ();
65 properties.Add (enableFragmentCacheProp);
66 properties.Add (enableOutputCacheProp);
67 properties.Add (omitVaryStarProp);
68 properties.Add (sendCacheControlHeaderProp);
69 properties.Add (enableKernelCacheForVaryByStarProp);
71 properties.Add (providersProp);
72 properties.Add (defaultProviderNameProp);
76 [ConfigurationProperty ("enableFragmentCache", DefaultValue = "True")]
77 public bool EnableFragmentCache {
78 get { return (bool) base [enableFragmentCacheProp];}
79 set { base[enableFragmentCacheProp] = value; }
82 [ConfigurationProperty ("enableOutputCache", DefaultValue = "True")]
83 public bool EnableOutputCache {
84 get { return (bool) base [enableOutputCacheProp];}
85 set { base[enableOutputCacheProp] = value; }
88 [ConfigurationProperty ("enableKernelCacheForVaryByStar", DefaultValue = "False")]
89 public bool EnableKernelCacheForVaryByStar {
90 get { return (bool) base [enableKernelCacheForVaryByStarProp]; }
91 set { base [enableKernelCacheForVaryByStarProp] = value; }
94 [ConfigurationProperty ("omitVaryStar", DefaultValue = "False")]
95 public bool OmitVaryStar {
96 get { return (bool) base [omitVaryStarProp];}
97 set { base[omitVaryStarProp] = value; }
100 [ConfigurationProperty ("sendCacheControlHeader", DefaultValue = "True")]
101 public bool SendCacheControlHeader {
102 get { return (bool) base [sendCacheControlHeaderProp];}
103 set { base[sendCacheControlHeaderProp] = value; }
107 [StringValidatorAttribute(MinLength = 1)]
108 [ConfigurationPropertyAttribute("defaultProvider", DefaultValue = "AspNetInternalProvider")]
109 public string DefaultProviderName {
110 get { return base [defaultProviderNameProp] as string; }
111 set { base [defaultProviderNameProp] = value; }
114 [ConfigurationPropertyAttribute("providers")]
115 public ProviderSettingsCollection Providers {
116 get { return base [providersProp] as ProviderSettingsCollection; }
120 protected override ConfigurationPropertyCollection Properties {
121 get { return properties; }