/mcs/class/System.Web/System.Web.Configuration_2.0/CompilationSection.cs

https://github.com/t-ashula/mono · C# · 254 lines · 191 code · 31 blank · 32 comment · 0 complexity · 299440a67b5d1d8ad34814d5a7bb55ae MD5 · raw file

  1. //
  2. // System.Web.Configuration.CompilationSection
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier (gonzalo@ximian.com)
  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. using System;
  30. using System.Configuration;
  31. using System.ComponentModel;
  32. namespace System.Web.Configuration
  33. {
  34. public sealed class CompilationSection : ConfigurationSection
  35. {
  36. static ConfigurationPropertyCollection properties;
  37. static ConfigurationProperty compilersProp;
  38. static ConfigurationProperty tempDirectoryProp;
  39. static ConfigurationProperty debugProp;
  40. static ConfigurationProperty strictProp;
  41. static ConfigurationProperty explicitProp;
  42. static ConfigurationProperty batchProp;
  43. static ConfigurationProperty batchTimeoutProp;
  44. static ConfigurationProperty maxBatchSizeProp;
  45. static ConfigurationProperty maxBatchGeneratedFileSizeProp;
  46. static ConfigurationProperty numRecompilesBeforeAppRestartProp;
  47. static ConfigurationProperty defaultLanguageProp;
  48. static ConfigurationProperty assembliesProp;
  49. static ConfigurationProperty assemblyPostProcessorTypeProp;
  50. static ConfigurationProperty buildProvidersProp;
  51. static ConfigurationProperty expressionBuildersProp;
  52. static ConfigurationProperty urlLinePragmasProp;
  53. static ConfigurationProperty codeSubDirectoriesProp;
  54. static ConfigurationProperty optimizeCompilationsProp;
  55. static ConfigurationProperty targetFrameworkProp;
  56. static CompilationSection ()
  57. {
  58. assembliesProp = new ConfigurationProperty ("assemblies", typeof (AssemblyCollection), null,
  59. null, PropertyHelper.DefaultValidator,
  60. ConfigurationPropertyOptions.None);
  61. assemblyPostProcessorTypeProp = new ConfigurationProperty ("assemblyPostProcessorType", typeof (string), "");
  62. batchProp = new ConfigurationProperty ("batch", typeof (bool), true);
  63. buildProvidersProp = new ConfigurationProperty ("buildProviders", typeof (BuildProviderCollection), null,
  64. null, PropertyHelper.DefaultValidator,
  65. ConfigurationPropertyOptions.None);
  66. batchTimeoutProp = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0),
  67. PropertyHelper.TimeSpanSecondsOrInfiniteConverter,
  68. PropertyHelper.PositiveTimeSpanValidator,
  69. ConfigurationPropertyOptions.None);
  70. codeSubDirectoriesProp = new ConfigurationProperty ("codeSubDirectories", typeof (CodeSubDirectoriesCollection), null,
  71. null, PropertyHelper.DefaultValidator,
  72. ConfigurationPropertyOptions.None);
  73. compilersProp = new ConfigurationProperty ("compilers", typeof (CompilerCollection), null,
  74. null, PropertyHelper.DefaultValidator,
  75. ConfigurationPropertyOptions.None);
  76. debugProp = new ConfigurationProperty ("debug", typeof (bool), false);
  77. defaultLanguageProp = new ConfigurationProperty ("defaultLanguage", typeof (string), "vb");
  78. expressionBuildersProp = new ConfigurationProperty ("expressionBuilders", typeof (ExpressionBuilderCollection), null,
  79. null, PropertyHelper.DefaultValidator,
  80. ConfigurationPropertyOptions.None);
  81. explicitProp = new ConfigurationProperty ("explicit", typeof (bool), true);
  82. maxBatchSizeProp = new ConfigurationProperty ("maxBatchSize", typeof (int), 1000);
  83. maxBatchGeneratedFileSizeProp = new ConfigurationProperty ("maxBatchGeneratedFileSize", typeof (int), 3000);
  84. numRecompilesBeforeAppRestartProp = new ConfigurationProperty ("numRecompilesBeforeAppRestart", typeof (int), 15);
  85. strictProp = new ConfigurationProperty ("strict", typeof (bool), false);
  86. tempDirectoryProp = new ConfigurationProperty ("tempDirectory", typeof (string), "");
  87. urlLinePragmasProp = new ConfigurationProperty ("urlLinePragmas", typeof (bool), false);
  88. // This is a 4.0 property but it is also supported in 3.5 with
  89. // this hotfix: http://support.microsoft.com/kb/961884
  90. optimizeCompilationsProp = new ConfigurationProperty ("optimizeCompilations", typeof (bool), false);
  91. // Mono ignores this as there is no way to switch the runtime version
  92. // dynamically while application is running
  93. targetFrameworkProp = new ConfigurationProperty ("targetFramework", typeof (string), null);
  94. properties = new ConfigurationPropertyCollection ();
  95. properties.Add (assembliesProp);
  96. properties.Add (assemblyPostProcessorTypeProp);
  97. properties.Add (batchProp);
  98. properties.Add (buildProvidersProp);
  99. properties.Add (batchTimeoutProp);
  100. properties.Add (codeSubDirectoriesProp);
  101. properties.Add (compilersProp);
  102. properties.Add (debugProp);
  103. properties.Add (defaultLanguageProp);
  104. properties.Add (expressionBuildersProp);
  105. properties.Add (explicitProp);
  106. properties.Add (maxBatchSizeProp);
  107. properties.Add (maxBatchGeneratedFileSizeProp);
  108. properties.Add (numRecompilesBeforeAppRestartProp);
  109. properties.Add (strictProp);
  110. properties.Add (tempDirectoryProp);
  111. properties.Add (urlLinePragmasProp);
  112. properties.Add (optimizeCompilationsProp);
  113. properties.Add (targetFrameworkProp);
  114. }
  115. public CompilationSection ()
  116. {
  117. }
  118. protected override void PostDeserialize ()
  119. {
  120. base.PostDeserialize ();
  121. }
  122. [MonoTODO ("why override this?")]
  123. protected internal override object GetRuntimeObject ()
  124. {
  125. return this;
  126. }
  127. [ConfigurationProperty ("assemblies")]
  128. public AssemblyCollection Assemblies {
  129. get { return (AssemblyCollection) base [assembliesProp]; }
  130. }
  131. [ConfigurationProperty ("assemblyPostProcessorType", DefaultValue = "")]
  132. public string AssemblyPostProcessorType {
  133. get { return (string) base[assemblyPostProcessorTypeProp]; }
  134. set { base[assemblyPostProcessorTypeProp] = value; }
  135. }
  136. [ConfigurationProperty ("batch", DefaultValue = "True")]
  137. public bool Batch {
  138. get { return (bool) base [batchProp]; }
  139. set { base [batchProp] = value; }
  140. }
  141. [TypeConverter (typeof (TimeSpanSecondsOrInfiniteConverter))]
  142. [TimeSpanValidator (MinValueString = "00:00:00")]
  143. [ConfigurationProperty ("batchTimeout", DefaultValue = "00:15:00")]
  144. public TimeSpan BatchTimeout {
  145. get { return (TimeSpan) base [batchTimeoutProp]; }
  146. set { base [batchTimeoutProp] = value; }
  147. }
  148. [ConfigurationProperty ("buildProviders")]
  149. public BuildProviderCollection BuildProviders {
  150. get { return (BuildProviderCollection) base [buildProvidersProp]; }
  151. }
  152. [ConfigurationProperty ("codeSubDirectories")]
  153. public CodeSubDirectoriesCollection CodeSubDirectories {
  154. get { return (CodeSubDirectoriesCollection) base [codeSubDirectoriesProp]; }
  155. }
  156. [ConfigurationProperty ("compilers")]
  157. public CompilerCollection Compilers {
  158. get { return (CompilerCollection) base [compilersProp]; }
  159. }
  160. [ConfigurationProperty ("debug", DefaultValue = "False")]
  161. public bool Debug {
  162. get { return (bool) base [debugProp]; }
  163. set { base [debugProp] = value; }
  164. }
  165. [ConfigurationProperty ("defaultLanguage", DefaultValue = "vb")]
  166. public string DefaultLanguage {
  167. get { return (string) base [defaultLanguageProp]; }
  168. set { base [defaultLanguageProp] = value; }
  169. }
  170. [ConfigurationProperty ("explicit", DefaultValue = "True")]
  171. public bool Explicit {
  172. get { return (bool) base [explicitProp]; }
  173. set { base [explicitProp] = value; }
  174. }
  175. [ConfigurationProperty ("expressionBuilders")]
  176. public ExpressionBuilderCollection ExpressionBuilders {
  177. get { return (ExpressionBuilderCollection) base [expressionBuildersProp]; }
  178. }
  179. [ConfigurationProperty ("maxBatchGeneratedFileSize", DefaultValue = "1000")]
  180. public int MaxBatchGeneratedFileSize {
  181. get { return (int) base [maxBatchGeneratedFileSizeProp]; }
  182. set { base [maxBatchGeneratedFileSizeProp] = value; }
  183. }
  184. [ConfigurationProperty ("maxBatchSize", DefaultValue = "1000")]
  185. public int MaxBatchSize {
  186. get { return (int) base [maxBatchSizeProp]; }
  187. set { base [maxBatchSizeProp] = value; }
  188. }
  189. [ConfigurationProperty ("numRecompilesBeforeAppRestart", DefaultValue = "15")]
  190. public int NumRecompilesBeforeAppRestart {
  191. get { return (int) base [numRecompilesBeforeAppRestartProp]; }
  192. set { base [numRecompilesBeforeAppRestartProp] = value; }
  193. }
  194. [ConfigurationProperty ("optimizeCompilations", DefaultValue = "False")]
  195. public bool OptimizeCompilations {
  196. get { return (bool) base [optimizeCompilationsProp]; }
  197. set { base [optimizeCompilationsProp] = value; }
  198. }
  199. [ConfigurationProperty ("strict", DefaultValue = "False")]
  200. public bool Strict {
  201. get { return (bool) base [strictProp]; }
  202. set { base [strictProp] = value; }
  203. }
  204. [ConfigurationProperty ("targetFramework", DefaultValue = null)]
  205. public string TargetFramework {
  206. get { return (string) base [targetFrameworkProp]; }
  207. set { base [targetFrameworkProp] = value; }
  208. }
  209. [ConfigurationProperty ("tempDirectory", DefaultValue = "")]
  210. public string TempDirectory {
  211. get { return (string) base [tempDirectoryProp]; }
  212. set { base [tempDirectoryProp] = value; }
  213. }
  214. [ConfigurationProperty ("urlLinePragmas", DefaultValue = "False")]
  215. public bool UrlLinePragmas {
  216. get { return (bool) base [urlLinePragmasProp]; }
  217. set { base [urlLinePragmasProp] = value; }
  218. }
  219. protected internal override ConfigurationPropertyCollection Properties {
  220. get { return properties; }
  221. }
  222. }
  223. }