move FrameworkName from corlib to System
[mcs.git] / class / System / System.Net.Configuration / RequestCachingSection.cs
blobf0aaf312fb983edf360a5c0e9b6056616d6f4e21
1 //
2 // System.Net.Configuration.RequestCachingSection.cs
3 //
4 // Authors:
5 // Tim Coleman (tim@timcoleman.com)
6 // Chris Toshok (toshok@ximian.com)
7 //
8 // Copyright (C) Tim Coleman, 2004
9 // (C) 2004,2005 Novell, Inc. (http://www.novell.com)
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #if NET_2_0 && CONFIGURATION_DEP
35 using System;
36 using System.Configuration;
37 using System.Net.Cache;
38 using System.Xml;
40 namespace System.Net.Configuration
42 public sealed class RequestCachingSection : ConfigurationSection
44 #region Fields
46 static ConfigurationPropertyCollection properties;
47 static ConfigurationProperty defaultFtpCachePolicyProp;
48 static ConfigurationProperty defaultHttpCachePolicyProp;
49 static ConfigurationProperty defaultPolicyLevelProp;
50 static ConfigurationProperty disableAllCachingProp;
51 static ConfigurationProperty isPrivateCacheProp;
52 static ConfigurationProperty unspecifiedMaximumAgeProp;
54 #endregion // Fields
56 #region Constructors
58 static RequestCachingSection ()
60 defaultFtpCachePolicyProp = new ConfigurationProperty ("defaultFtpCachePolicy", typeof (FtpCachePolicyElement));
61 defaultHttpCachePolicyProp = new ConfigurationProperty ("defaultHttpCachePolicy", typeof (HttpCachePolicyElement));
62 defaultPolicyLevelProp = new ConfigurationProperty ("defaultPolicyLevel", typeof (RequestCacheLevel), RequestCacheLevel.BypassCache);
63 disableAllCachingProp = new ConfigurationProperty ("disableAllCaching", typeof (bool), false);
64 isPrivateCacheProp = new ConfigurationProperty ("isPrivateCache", typeof (bool), true);
65 unspecifiedMaximumAgeProp = new ConfigurationProperty ("unspecifiedMaximumAge", typeof (TimeSpan), new TimeSpan (1, 0, 0, 0));
66 properties = new ConfigurationPropertyCollection ();
68 properties.Add (defaultFtpCachePolicyProp);
69 properties.Add (defaultHttpCachePolicyProp);
70 properties.Add (defaultPolicyLevelProp);
71 properties.Add (disableAllCachingProp);
72 properties.Add (isPrivateCacheProp);
73 properties.Add (unspecifiedMaximumAgeProp);
76 public RequestCachingSection ()
80 #endregion // Constructors
82 #region Properties
84 [ConfigurationProperty ("defaultFtpCachePolicy")]
85 public FtpCachePolicyElement DefaultFtpCachePolicy {
86 get { return (FtpCachePolicyElement) base [defaultFtpCachePolicyProp]; }
89 [ConfigurationProperty ("defaultHttpCachePolicy")]
90 public HttpCachePolicyElement DefaultHttpCachePolicy {
91 get { return (HttpCachePolicyElement) base [defaultHttpCachePolicyProp]; }
94 [ConfigurationProperty ("defaultPolicyLevel", DefaultValue = "BypassCache")]
95 public RequestCacheLevel DefaultPolicyLevel {
96 get { return (RequestCacheLevel) base [defaultPolicyLevelProp]; }
97 set { base [defaultPolicyLevelProp] = value; }
100 [ConfigurationProperty ("disableAllCaching", DefaultValue = "False")]
101 public bool DisableAllCaching {
102 get { return (bool) base [disableAllCachingProp]; }
103 set { base [disableAllCachingProp] = value; }
106 [ConfigurationProperty ("isPrivateCache", DefaultValue = "True")]
107 public bool IsPrivateCache {
108 get { return (bool) base [isPrivateCacheProp]; }
109 set { base [isPrivateCacheProp] = value; }
112 [ConfigurationProperty ("unspecifiedMaximumAge", DefaultValue = "1.00:00:00")]
113 public TimeSpan UnspecifiedMaximumAge {
114 get { return (TimeSpan) base [unspecifiedMaximumAgeProp]; }
115 set { base [unspecifiedMaximumAgeProp] = value; }
118 protected override ConfigurationPropertyCollection Properties {
119 get { return properties; }
122 #endregion // Properties
124 #region Methods
126 [MonoTODO]
127 protected override void PostDeserialize ()
129 base.PostDeserialize ();
132 [MonoTODO]
133 protected override void DeserializeElement (XmlReader reader, bool serializeCollectionKey)
135 base.DeserializeElement (reader, serializeCollectionKey);
138 #endregion // Methods
142 #endif