CompilationSection.cs 9.0 KB

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