CompilationSection.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. null, PropertyHelper.DefaultValidator,
  59. ConfigurationPropertyOptions.None);
  60. assemblyPostProcessorTypeProp = new ConfigurationProperty ("assemblyPostProcessorType", typeof (string), "");
  61. batchProp = new ConfigurationProperty ("batch", typeof (bool), true);
  62. #if !TARGET_JVM
  63. buildProvidersProp = new ConfigurationProperty ("buildProviders", typeof (BuildProviderCollection), null,
  64. null, PropertyHelper.DefaultValidator,
  65. ConfigurationPropertyOptions.None);
  66. #endif
  67. batchTimeoutProp = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0),
  68. PropertyHelper.TimeSpanSecondsOrInfiniteConverter,
  69. PropertyHelper.PositiveTimeSpanValidator,
  70. ConfigurationPropertyOptions.None);
  71. codeSubDirectoriesProp = new ConfigurationProperty ("codeSubDirectories", typeof (CodeSubDirectoriesCollection), null,
  72. null, PropertyHelper.DefaultValidator,
  73. ConfigurationPropertyOptions.None);
  74. compilersProp = new ConfigurationProperty ("compilers", typeof (CompilerCollection), null,
  75. null, PropertyHelper.DefaultValidator,
  76. ConfigurationPropertyOptions.None);
  77. debugProp = new ConfigurationProperty ("debug", typeof (bool), false);
  78. defaultLanguageProp = new ConfigurationProperty ("defaultLanguage", typeof (string), "vb");
  79. expressionBuildersProp = new ConfigurationProperty ("expressionBuilders", typeof (ExpressionBuilderCollection), null,
  80. null, PropertyHelper.DefaultValidator,
  81. ConfigurationPropertyOptions.None);
  82. explicitProp = new ConfigurationProperty ("explicit", typeof (bool), true);
  83. maxBatchSizeProp = new ConfigurationProperty ("maxBatchSize", typeof (int), 1000);
  84. maxBatchGeneratedFileSizeProp = new ConfigurationProperty ("maxBatchGeneratedFileSize", typeof (int), 3000);
  85. numRecompilesBeforeAppRestartProp = new ConfigurationProperty ("numRecompilesBeforeAppRestart", typeof (int), 15);
  86. strictProp = new ConfigurationProperty ("strict", typeof (bool), false);
  87. tempDirectoryProp = new ConfigurationProperty ("tempDirectory", typeof (string), "");
  88. urlLinePragmasProp = new ConfigurationProperty ("urlLinePragmas", typeof (bool), false);
  89. properties = new ConfigurationPropertyCollection ();
  90. properties.Add (assembliesProp);
  91. properties.Add (assemblyPostProcessorTypeProp);
  92. properties.Add (batchProp);
  93. #if !TARGET_JVM
  94. properties.Add (buildProvidersProp);
  95. #endif
  96. properties.Add (batchTimeoutProp);
  97. properties.Add (codeSubDirectoriesProp);
  98. properties.Add (compilersProp);
  99. properties.Add (debugProp);
  100. properties.Add (defaultLanguageProp);
  101. properties.Add (expressionBuildersProp);
  102. properties.Add (explicitProp);
  103. properties.Add (maxBatchSizeProp);
  104. properties.Add (maxBatchGeneratedFileSizeProp);
  105. properties.Add (numRecompilesBeforeAppRestartProp);
  106. properties.Add (strictProp);
  107. properties.Add (tempDirectoryProp);
  108. properties.Add (urlLinePragmasProp);
  109. }
  110. public CompilationSection ()
  111. {
  112. }
  113. protected override void PostDeserialize ()
  114. {
  115. base.PostDeserialize ();
  116. }
  117. [MonoTODO ("why override this?")]
  118. protected override object GetRuntimeObject ()
  119. {
  120. return this;
  121. }
  122. [ConfigurationProperty ("assemblies")]
  123. public AssemblyCollection Assemblies {
  124. get { return (AssemblyCollection) base [assembliesProp]; }
  125. }
  126. [ConfigurationProperty ("assemblyPostProcessorType", DefaultValue = "")]
  127. public string AssemblyPostProcessorType {
  128. get { return (string) base[assemblyPostProcessorTypeProp]; }
  129. set { base[assemblyPostProcessorTypeProp] = value; }
  130. }
  131. [ConfigurationProperty ("batch", DefaultValue = "True")]
  132. public bool Batch {
  133. get { return (bool) base [batchProp]; }
  134. set { base [batchProp] = value; }
  135. }
  136. [TypeConverter (typeof (TimeSpanSecondsOrInfiniteConverter))]
  137. [TimeSpanValidator (MinValueString = "00:00:00")]
  138. [ConfigurationProperty ("batchTimeout", DefaultValue = "00:15:00")]
  139. public TimeSpan BatchTimeout {
  140. get { return (TimeSpan) base [batchTimeoutProp]; }
  141. set { base [batchTimeoutProp] = value; }
  142. }
  143. #if !TARGET_JVM
  144. [ConfigurationProperty ("buildProviders")]
  145. public BuildProviderCollection BuildProviders {
  146. get { return (BuildProviderCollection) base [buildProvidersProp]; }
  147. }
  148. #endif
  149. [ConfigurationProperty ("codeSubDirectories")]
  150. public CodeSubDirectoriesCollection CodeSubDirectories {
  151. get { return (CodeSubDirectoriesCollection) base [codeSubDirectoriesProp]; }
  152. }
  153. [ConfigurationProperty ("compilers")]
  154. public CompilerCollection Compilers {
  155. get { return (CompilerCollection) base [compilersProp]; }
  156. }
  157. [ConfigurationProperty ("debug", DefaultValue = "False")]
  158. public bool Debug {
  159. get { return (bool) base [debugProp]; }
  160. set { base [debugProp] = value; }
  161. }
  162. [ConfigurationProperty ("defaultLanguage", DefaultValue = "vb")]
  163. public string DefaultLanguage {
  164. get { return (string) base [defaultLanguageProp]; }
  165. set { base [defaultLanguageProp] = value; }
  166. }
  167. [ConfigurationProperty ("explicit", DefaultValue = "True")]
  168. public bool Explicit {
  169. get { return (bool) base [explicitProp]; }
  170. set { base [explicitProp] = value; }
  171. }
  172. [ConfigurationProperty ("expressionBuilders")]
  173. public ExpressionBuilderCollection ExpressionBuilders {
  174. get { return (ExpressionBuilderCollection) base [expressionBuildersProp]; }
  175. }
  176. [ConfigurationProperty ("maxBatchGeneratedFileSize", DefaultValue = "1000")]
  177. public int MaxBatchGeneratedFileSize {
  178. get { return (int) base [maxBatchGeneratedFileSizeProp]; }
  179. set { base [maxBatchGeneratedFileSizeProp] = value; }
  180. }
  181. [ConfigurationProperty ("maxBatchSize", DefaultValue = "1000")]
  182. public int MaxBatchSize {
  183. get { return (int) base [maxBatchSizeProp]; }
  184. set { base [maxBatchSizeProp] = value; }
  185. }
  186. [ConfigurationProperty ("numRecompilesBeforeAppRestart", DefaultValue = "15")]
  187. public int NumRecompilesBeforeAppRestart {
  188. get { return (int) base [numRecompilesBeforeAppRestartProp]; }
  189. set { base [numRecompilesBeforeAppRestartProp] = value; }
  190. }
  191. [ConfigurationProperty ("strict", DefaultValue = "False")]
  192. public bool Strict {
  193. get { return (bool) base [strictProp]; }
  194. set { base [strictProp] = value; }
  195. }
  196. [ConfigurationProperty ("tempDirectory", DefaultValue = "")]
  197. public string TempDirectory {
  198. get { return (string) base [tempDirectoryProp]; }
  199. set { base [tempDirectoryProp] = value; }
  200. }
  201. [ConfigurationProperty ("urlLinePragmas", DefaultValue = "False")]
  202. public bool UrlLinePragmas {
  203. get { return (bool) base [urlLinePragmasProp]; }
  204. set { base [urlLinePragmasProp] = value; }
  205. }
  206. protected override ConfigurationPropertyCollection Properties {
  207. get { return properties; }
  208. }
  209. }
  210. }
  211. #endif // NET_2_0