Parcourir la source

* Page.jvm.cs: IsMultiForm optimized, cached configuration call

svn path=/trunk/mcs/; revision=89920
Vladimir Krasnov il y a 18 ans
Parent
commit
0840dcace2

+ 4 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,7 @@
+2007-11-19  Vladimir Krasnov  <[email protected]>
+
+	* Page.jvm.cs: IsMultiForm optimized, cached configuration call
+
 2007-11-14  Marek Habersack  <[email protected]>
 
 	* SimpleWebHandlerParser.cs: expect GetTypeFromBin to be called

+ 11 - 4
mcs/class/System.Web/System.Web.UI/Page.jvm.cs

@@ -79,12 +79,19 @@ namespace System.Web.UI
 			}
 		}
 		
+		bool _isMultiForm = false;
+		bool _isMultiFormInited = false;
+
 		internal bool IsMultiForm {
 			get {
-				Mainsoft.Web.Configuration.PagesSection pageSection = (Mainsoft.Web.Configuration.PagesSection) System.Web.Configuration.WebConfigurationManager.GetSection ("mainsoft.web/pages");
-				if (pageSection != null)
-					return pageSection.MultiForm;
-				return false;
+				if (!_isMultiFormInited) {
+					Mainsoft.Web.Configuration.PagesSection pageSection = (Mainsoft.Web.Configuration.PagesSection) System.Web.Configuration.WebConfigurationManager.GetSection ("mainsoft.web/pages");
+					if (pageSection != null)
+						_isMultiForm = pageSection.MultiForm;
+
+					_isMultiFormInited = true;
+				}
+				return _isMultiForm;
 			}
 		}