RequestCachingSection.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // System.Net.Configuration.RequestCachingSection.cs
  3. //
  4. // Authors:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2004
  8. // (c) 2004 Novell, Inc. (http://www.novell.com)
  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. #if NET_2_0 && XML_DEP
  31. using System;
  32. using System.Configuration;
  33. using System.Net.Cache;
  34. namespace System.Net.Configuration
  35. {
  36. public sealed class RequestCachingSection : ConfigurationSection
  37. {
  38. #region Fields
  39. ConfigurationPropertyCollection properties;
  40. static ConfigurationProperty defaultHttpCachePolicy = new ConfigurationProperty ("DefaultHttpCachePolicy", typeof (HttpCachePolicyElement), new HttpCachePolicyElement ());
  41. static ConfigurationProperty defaultPolicyLevel = new ConfigurationProperty ("DefaultPolicyLevel", typeof (RequestCacheLevel), RequestCacheLevel.BypassCache);
  42. static ConfigurationProperty disableAllCaching = new ConfigurationProperty ("DisableAllCaching", typeof (bool), false);
  43. static ConfigurationProperty isPrivateCache = new ConfigurationProperty ("IsPrivateCache", typeof (bool), true);
  44. static ConfigurationProperty unspecifiedMaximumAge = new ConfigurationProperty ("UnspecifiedMaximumAge", typeof (TimeSpan), new TimeSpan (1, 0, 0, 0));
  45. #endregion // Fields
  46. #region Constructors
  47. public RequestCachingSection ()
  48. {
  49. properties = new ConfigurationPropertyCollection ();
  50. properties.Add (defaultHttpCachePolicy);
  51. properties.Add (defaultPolicyLevel);
  52. properties.Add (disableAllCaching);
  53. properties.Add (isPrivateCache);
  54. properties.Add (unspecifiedMaximumAge);
  55. }
  56. #endregion // Constructors
  57. #region Properties
  58. public HttpCachePolicyElement DefaultHttpCachePolicy {
  59. get { return (HttpCachePolicyElement) base [defaultHttpCachePolicy]; }
  60. }
  61. public RequestCacheLevel DefaultPolicyLevel {
  62. get { return (RequestCacheLevel) base [defaultPolicyLevel]; }
  63. set { base [defaultPolicyLevel] = value; }
  64. }
  65. public bool DisableAllCaching {
  66. get { return (bool) base [disableAllCaching]; }
  67. set { base [disableAllCaching] = value; }
  68. }
  69. public bool IsPrivateCache {
  70. get { return (bool) base [isPrivateCache]; }
  71. set { base [isPrivateCache] = value; }
  72. }
  73. protected internal override ConfigurationPropertyCollection Properties {
  74. get { return properties; }
  75. }
  76. public TimeSpan UnspecifiedMaximumAge {
  77. get { return (TimeSpan) base [unspecifiedMaximumAge]; }
  78. set { base [unspecifiedMaximumAge] = value; }
  79. }
  80. #endregion // Properties
  81. #region Methods
  82. [MonoTODO]
  83. protected internal override object GetRuntimeObject ()
  84. {
  85. throw new NotImplementedException ();
  86. }
  87. #endregion // Methods
  88. }
  89. }
  90. #endif