CompilationSection.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 : InternalSection
  36. {
  37. static ConfigurationPropertyCollection props;
  38. static ConfigurationProperty compilers;
  39. static ConfigurationProperty tempDirectory;
  40. static ConfigurationProperty debug;
  41. static ConfigurationProperty strict;
  42. static ConfigurationProperty _explicit;
  43. static ConfigurationProperty batch;
  44. static ConfigurationProperty batchTimeout;
  45. static ConfigurationProperty maxBatchSize;
  46. static ConfigurationProperty maxBatchGeneratedFileSize;
  47. static ConfigurationProperty numRecompilesBeforeAppRestart;
  48. static ConfigurationProperty defaultLanguage;
  49. static ConfigurationProperty assemblies;
  50. static ConfigurationProperty buildProviders;
  51. static ConfigurationProperty expressionBuilders;
  52. static ConfigurationProperty urlLinePragmas;
  53. static ConfigurationProperty codeSubDirectories;
  54. static CompilationSection ()
  55. {
  56. props = new ConfigurationPropertyCollection ();
  57. Type strType = typeof (string);
  58. TypeConverter strTypeConv = new StringConverter ();
  59. Type boolType = typeof (bool);
  60. TypeConverter boolTypeConv = new BooleanConverter ();
  61. Type intType = typeof (int);
  62. TypeConverter intTypeConv = new Int32Converter ();
  63. assemblies = new ConfigurationProperty ("assemblies", typeof (AssemblyCollection), 0);
  64. props.Add (assemblies);
  65. batch = new ConfigurationProperty ("batch", boolType, true, boolTypeConv, null, 0);
  66. props.Add (batch);
  67. buildProviders = new ConfigurationProperty ("buidProviders", typeof (BuildProviderCollection), 0);
  68. props.Add (buildProviders);
  69. batchTimeout = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0),
  70. new TimeSpanConverter (), null, 0);
  71. props.Add (batchTimeout);
  72. codeSubDirectories = new ConfigurationProperty ("codeSubDirectories", typeof (CodeSubDirectoriesCollection), 0);
  73. props.Add (codeSubDirectories);
  74. //compilers = new ConfigurationProperty ("compilers", typeof (CompilerCollection), 0);
  75. //props.Add (compilers);
  76. debug = new ConfigurationProperty ("debug", boolType, false, boolTypeConv, null, 0);
  77. props.Add (debug);
  78. defaultLanguage = new ConfigurationProperty ("defaultLanguage", strType, "c#", strTypeConv, null, 0);
  79. props.Add (defaultLanguage);
  80. expressionBuilders = new ConfigurationProperty ("expressionBuilders", typeof (ExpressionBuilderCollection), 0);
  81. props.Add (expressionBuilders);
  82. _explicit = new ConfigurationProperty ("explicit", boolType, true, boolTypeConv, null, 0);
  83. props.Add (_explicit);
  84. maxBatchSize = new ConfigurationProperty ("maxBatchSize", intType, 1000, intTypeConv, null, 0);
  85. props.Add (maxBatchSize);
  86. maxBatchGeneratedFileSize = new ConfigurationProperty ("maxBatchGeneratedFileSize", intType, 3000, intTypeConv, null, 0);
  87. props.Add (maxBatchGeneratedFileSize);
  88. numRecompilesBeforeAppRestart = new ConfigurationProperty ("numRecompilesBeforeAppRestart", intType, 15, intTypeConv, null, 0);
  89. props.Add (numRecompilesBeforeAppRestart);
  90. strict = new ConfigurationProperty ("strict", boolType, false, boolTypeConv, null, 0);
  91. props.Add (strict);
  92. tempDirectory = new ConfigurationProperty ("tempDirectory", strType, "", strTypeConv, null, 0);
  93. props.Add (tempDirectory);
  94. urlLinePragmas = new ConfigurationProperty ("urlLinePragmas", boolType, false, boolTypeConv, null, 0);
  95. props.Add (urlLinePragmas);
  96. }
  97. public CompilationSection ()
  98. {
  99. }
  100. public AssemblyCollection Assemblies {
  101. get { return (AssemblyCollection) this [assemblies]; }
  102. }
  103. public bool Batch {
  104. get { return (bool) this [batch]; }
  105. set { this [batch] = value; }
  106. }
  107. public TimeSpan BatchTimeout {
  108. get { return (TimeSpan) this [batchTimeout]; }
  109. set { this [batchTimeout] = value; }
  110. }
  111. public BuildProviderCollection BuildProviders {
  112. get { return (BuildProviderCollection) this [buildProviders]; }
  113. }
  114. public CodeSubDirectoriesCollection CodeSubDirectories {
  115. get { return (CodeSubDirectoriesCollection) this [codeSubDirectories]; }
  116. }
  117. /*
  118. public CompilerCollection Compilers {
  119. get { return (CompilerCollection) this [compilers]; }
  120. }
  121. */
  122. public bool Debug {
  123. get { return (bool) this [debug]; }
  124. set { this [debug] = value; }
  125. }
  126. public string DefaultLanguage {
  127. get { return (string) this [defaultLanguage]; }
  128. set { this [defaultLanguage] = value; }
  129. }
  130. public bool Explicit {
  131. get { return (bool) this [_explicit]; }
  132. set { this [_explicit] = value; }
  133. }
  134. public ExpressionBuilderCollection ExpressionBuilders {
  135. get { return (ExpressionBuilderCollection) this [expressionBuilders]; }
  136. }
  137. public int MaxBatchGeneratedFileSize {
  138. get { return (int) this [maxBatchGeneratedFileSize]; }
  139. set { this [maxBatchGeneratedFileSize] = value; }
  140. }
  141. public int MaxBatchSize {
  142. get { return (int) this [maxBatchSize]; }
  143. set { this [maxBatchSize] = value; }
  144. }
  145. public int NumRecompilesBeforeAppRestart {
  146. get { return (int) this [numRecompilesBeforeAppRestart]; }
  147. set { this [numRecompilesBeforeAppRestart] = value; }
  148. }
  149. public bool Strict {
  150. get { return (bool) this [strict]; }
  151. set { this [strict] = value; }
  152. }
  153. public string TempDirectory {
  154. get { return (string) this [tempDirectory]; }
  155. set { this [tempDirectory] = value; }
  156. }
  157. public bool UrlLinePragmas {
  158. get { return (bool) this [urlLinePragmas]; }
  159. set { this [urlLinePragmas] = value; }
  160. }
  161. protected override ConfigurationPropertyCollection Properties {
  162. get { return props; }
  163. }
  164. }
  165. }
  166. #endif // NET_2_0