Przeglądaj źródła

2004-01-28 Gonzalo Paniagua Javier <[email protected]>

	* AspGenerator.cs: use the Cache to store compiled Types. Don't parse
	pages more than once. Thanks to Eric Lindvall for pointing this out.

svn path=/trunk/mcs/; revision=22557
Gonzalo Paniagua Javier 22 lat temu
rodzic
commit
0add6b40f7

+ 12 - 1
mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs

@@ -11,6 +11,7 @@ using System.Collections;
 using System.CodeDom.Compiler;
 using System.IO;
 using System.Text;
+using System.Web.Caching;
 using System.Web.UI;
 using System.Web.Util;
 
@@ -176,6 +177,11 @@ namespace System.Web.Compilation
 
 		public Type GetCompiledType ()
 		{
+			Type type = (Type) HttpRuntime.Cache.Get (tparser.InputFile);
+			if (type != null) {
+				return type;
+			}
+
 			InitParser (Path.GetFullPath (tparser.InputFile));
 			DoParse ();
 #if DEBUG
@@ -188,7 +194,12 @@ namespace System.Web.Compilation
 
 			BaseCompiler compiler = GetCompilerFromType ();
 
-			return compiler.GetCompiledType ();
+			type = compiler.GetCompiledType ();
+			CacheDependency cd = new CacheDependency ((string[])
+							tparser.Dependencies.ToArray (typeof (string)));
+
+			HttpRuntime.Cache.Insert (tparser.InputFile, type, cd);
+			return type;
 		}
 
 #if DEBUG

+ 5 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,8 @@
+2004-01-28  Gonzalo Paniagua Javier <[email protected]>
+
+	* AspGenerator.cs: use the Cache to store compiled Types. Don't parse
+	pages more than once. Thanks to Eric Lindvall for pointing this out.
+
 2004-01-23  Gonzalo Paniagua Javier <[email protected]>
 
 	* TemplateControlCompiler.cs: allow handling subproperties for other