2
0

CompilationSection.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. //
  2. // System.Web.Configuration.CompilationSection
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (c) Copyright 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. #if NET_2_0
  30. using System;
  31. using System.Configuration;
  32. using System.ComponentModel;
  33. namespace System.Web.Configuration
  34. {
  35. public sealed class CompilationSection : ConfigurationSection
  36. {
  37. static ConfigurationPropertyCollection properties;
  38. static ConfigurationProperty compilersProp;
  39. static ConfigurationProperty tempDirectoryProp;
  40. static ConfigurationProperty debugProp;
  41. static ConfigurationProperty strictProp;
  42. static ConfigurationProperty explicitProp;
  43. static ConfigurationProperty batchProp;
  44. static ConfigurationProperty batchTimeoutProp;
  45. static ConfigurationProperty maxBatchSizeProp;
  46. static ConfigurationProperty maxBatchGeneratedFileSizeProp;
  47. static ConfigurationProperty numRecompilesBeforeAppRestartProp;
  48. static ConfigurationProperty defaultLanguageProp;
  49. static ConfigurationProperty assembliesProp;
  50. static ConfigurationProperty assemblyPostProcessorTypeProp;
  51. static ConfigurationProperty buildProvidersProp;
  52. static ConfigurationProperty expressionBuildersProp;
  53. static ConfigurationProperty urlLinePragmasProp;
  54. static ConfigurationProperty codeSubDirectoriesProp;
  55. static CompilationSection ()
  56. {
  57. assembliesProp = new ConfigurationProperty ("assemblies", typeof (AssemblyCollection), null);
  58. assemblyPostProcessorTypeProp = new ConfigurationProperty ("assemblyPostProcessorType", typeof (string), "");
  59. batchProp = new ConfigurationProperty ("batch", typeof (bool), true);
  60. buildProvidersProp = new ConfigurationProperty ("buidProviders", typeof (BuildProviderCollection), null);
  61. batchTimeoutProp = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0));
  62. codeSubDirectoriesProp = new ConfigurationProperty ("codeSubDirectories", typeof (CodeSubDirectoriesCollection), null);
  63. compilersProp = new ConfigurationProperty ("compilers", typeof (CompilerCollection), null);
  64. debugProp = new ConfigurationProperty ("debug", typeof (bool), false);
  65. defaultLanguageProp = new ConfigurationProperty ("defaultLanguage", typeof (string), "vb");
  66. expressionBuildersProp = new ConfigurationProperty ("expressionBuilders", typeof (ExpressionBuilderCollection), null);
  67. explicitProp = new ConfigurationProperty ("explicit", typeof (bool), true);
  68. maxBatchSizeProp = new ConfigurationProperty ("maxBatchSize", typeof (int), 1000);
  69. maxBatchGeneratedFileSizeProp = new ConfigurationProperty ("maxBatchGeneratedFileSize", typeof (int), 3000);
  70. numRecompilesBeforeAppRestartProp = new ConfigurationProperty ("numRecompilesBeforeAppRestart", typeof (int), 15);
  71. strictProp = new ConfigurationProperty ("strict", typeof (bool), false);
  72. tempDirectoryProp = new ConfigurationProperty ("tempDirectory", typeof (string), "");
  73. urlLinePragmasProp = new ConfigurationProperty ("urlLinePragmas", typeof (bool));
  74. properties = new ConfigurationPropertyCollection ();
  75. properties.Add (assembliesProp);
  76. properties.Add (assemblyPostProcessorTypeProp);
  77. properties.Add (batchProp);
  78. properties.Add (buildProvidersProp);
  79. properties.Add (batchTimeoutProp);
  80. properties.Add (codeSubDirectoriesProp);
  81. properties.Add (compilersProp);
  82. properties.Add (debugProp);
  83. properties.Add (defaultLanguageProp);
  84. properties.Add (expressionBuildersProp);
  85. properties.Add (explicitProp);
  86. properties.Add (maxBatchSizeProp);
  87. properties.Add (maxBatchGeneratedFileSizeProp);
  88. properties.Add (numRecompilesBeforeAppRestartProp);
  89. properties.Add (strictProp);
  90. properties.Add (tempDirectoryProp);
  91. properties.Add (urlLinePragmasProp);
  92. }
  93. public CompilationSection ()
  94. {
  95. }
  96. [MonoTODO]
  97. protected override void PostDeserialize ()
  98. {
  99. base.PostDeserialize ();
  100. }
  101. [MonoTODO]
  102. protected override object GetRuntimeObject ()
  103. {
  104. return this;
  105. }
  106. [ConfigurationProperty ("assemblies")]
  107. public AssemblyCollection Assemblies {
  108. get { return (AssemblyCollection) base [assembliesProp]; }
  109. }
  110. [ConfigurationProperty ("assemblyPostProcessorType", DefaultValue = "")]
  111. public string AssemblyPostProcessorType {
  112. get { return (string) base[assemblyPostProcessorTypeProp]; }
  113. set { base[assemblyPostProcessorTypeProp] = value; }
  114. }
  115. [ConfigurationProperty ("batch", DefaultValue = "True")]
  116. public bool Batch {
  117. get { return (bool) base [batchProp]; }
  118. set { base [batchProp] = value; }
  119. }
  120. [TypeConverter (typeof (TimeSpanSecondsOrInfiniteConverter))]
  121. [TimeSpanValidator (MinValueString = "00:00:00")]
  122. [ConfigurationProperty ("batchTimeout", DefaultValue = "00:15:00")]
  123. public TimeSpan BatchTimeout {
  124. get { return (TimeSpan) base [batchTimeoutProp]; }
  125. set { base [batchTimeoutProp] = value; }
  126. }
  127. [ConfigurationProperty ("buildProviders")]
  128. public BuildProviderCollection BuildProviders {
  129. get { return (BuildProviderCollection) base [buildProvidersProp]; }
  130. }
  131. [ConfigurationProperty ("codeSubDirectories")]
  132. public CodeSubDirectoriesCollection CodeSubDirectories {
  133. get { return (CodeSubDirectoriesCollection) base [codeSubDirectoriesProp]; }
  134. }
  135. [ConfigurationProperty ("compilers")]
  136. public CompilerCollection Compilers {
  137. get { return (CompilerCollection) base [compilersProp]; }
  138. }
  139. [ConfigurationProperty ("debug", DefaultValue = "False")]
  140. public bool Debug {
  141. get { return (bool) base [debugProp]; }
  142. set { base [debugProp] = value; }
  143. }
  144. [ConfigurationProperty ("defaultLanguage", DefaultValue = "vb")]
  145. public string DefaultLanguage {
  146. get { return (string) base [defaultLanguageProp]; }
  147. set { base [defaultLanguageProp] = value; }
  148. }
  149. [ConfigurationProperty ("explicit", DefaultValue = "True")]
  150. public bool Explicit {
  151. get { return (bool) base [explicitProp]; }
  152. set { base [explicitProp] = value; }
  153. }
  154. [ConfigurationProperty ("expressionBuilders")]
  155. public ExpressionBuilderCollection ExpressionBuilders {
  156. get { return (ExpressionBuilderCollection) base [expressionBuildersProp]; }
  157. }
  158. [ConfigurationProperty ("maxBatchGeneratedFileSize", DefaultValue = "1000")]
  159. public int MaxBatchGeneratedFileSize {
  160. get { return (int) base [maxBatchGeneratedFileSizeProp]; }
  161. set { base [maxBatchGeneratedFileSizeProp] = value; }
  162. }
  163. [ConfigurationProperty ("maxBatchSize", DefaultValue = "1000")]
  164. public int MaxBatchSize {
  165. get { return (int) base [maxBatchSizeProp]; }
  166. set { base [maxBatchSizeProp] = value; }
  167. }
  168. [ConfigurationProperty ("numRecompilesBeforeAppRestart", DefaultValue = "15")]
  169. public int NumRecompilesBeforeAppRestart {
  170. get { return (int) base [numRecompilesBeforeAppRestartProp]; }
  171. set { base [numRecompilesBeforeAppRestartProp] = value; }
  172. }
  173. [ConfigurationProperty ("strict", DefaultValue = "False")]
  174. public bool Strict {
  175. get { return (bool) base [strictProp]; }
  176. set { base [strictProp] = value; }
  177. }
  178. [ConfigurationProperty ("tempDirectory", DefaultValue = "")]
  179. public string TempDirectory {
  180. get { return (string) base [tempDirectoryProp]; }
  181. set { base [tempDirectoryProp] = value; }
  182. }
  183. [ConfigurationProperty ("urlLinePragmas", DefaultValue = "False")]
  184. public bool UrlLinePragmas {
  185. get { return (bool) base [urlLinePragmasProp]; }
  186. set { base [urlLinePragmasProp] = value; }
  187. }
  188. protected override ConfigurationPropertyCollection Properties {
  189. get { return properties; }
  190. }
  191. }
  192. }
  193. #endif // NET_2_0