Browse Source

* ProfileParser.jvm.cs: Profile types loading optimized

svn path=/trunk/mcs/; revision=91148
Vladimir Krasnov 18 years ago
parent
commit
986b802e43

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

@@ -1,3 +1,7 @@
+2007-12-12  Vladimir Krasnov  <[email protected]>
+
+	* ProfileParser.jvm.cs: Profile types loading optimized
+
 2007-12-11  Vladimir Krasnov  <[email protected]>
 
 	* ProfileManager.cs: fixed Providers property to be thread safe

+ 30 - 37
mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs

@@ -38,46 +38,39 @@ using System.Web.J2EE;
 namespace System.Web.Profile
 {
 	internal sealed class ProfileParser
-	{
-		internal ProfileParser (HttpContext context)
-		{
-		}
-
-		public static Type GetProfileCommonType (HttpContext context)
-		{
-			if (!ProfileCommonTypeExists)
-				return null;
-
-			Type profileBaseType = Type.GetType ("ProfileCommon");
-			if (profileBaseType == null) {
-				//PageMapper call
-				string virtualPath = "~/App_Code/ProfileCommon";
-				string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath).TrimEnd ('/');
-				profileBaseType = PageMapper.GetObjectType (context, resolvedUrl, false);
+	{
+		const string virtualPathCommon = "~/App_Code/ProfileCommon";
+		const string virtualPathGroup = "~/App_Code/ProfileGroup";
 
-				ProfileCommonTypeExists = profileBaseType != null;
-			}
-			return profileBaseType;
-		}
-
-		public static Type GetProfileGroupType (HttpContext context, string groupName)
+		internal ProfileParser (HttpContext context)
 		{
-			if (!ProfileGroupTypeExists)
-				return null;
-			
-			Type profileGroupType = Type.GetType ("ProfileGroup" + groupName);
-			if (profileGroupType == null) {
-				//PageMapper call
-				string virtualPath = "~/App_Code/ProfileGroup" + groupName;
-				string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPath).TrimEnd ('/');
-				profileGroupType = PageMapper.GetObjectType (context, resolvedUrl, false);
-
-				ProfileGroupTypeExists = profileGroupType != null;
-			}
-			return profileGroupType;
+		}
+
+		public static Type GetProfileCommonType (HttpContext context)
+		{
+			if (!ProfileCommonTypeExists)
+				return null;
+
+			string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPathCommon).TrimEnd ('/');
+			Type profileBaseType = PageMapper.GetObjectType (context, resolvedUrl, false);
+
+			ProfileCommonTypeExists = profileBaseType != null;
+			return profileBaseType;
+		}
+
+		public static Type GetProfileGroupType (HttpContext context, string groupName)
+		{
+			if (!ProfileGroupTypeExists)
+				return null;
+
+			string resolvedUrl = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute (virtualPathGroup + groupName).TrimEnd ('/');
+			Type profileGroupType = PageMapper.GetObjectType (context, resolvedUrl, false);
+
+			ProfileGroupTypeExists = profileGroupType != null;
+			return profileGroupType;
 		}
 
-		const string profileKey = "System.Web.Profile.ProfileCommonType";
+		const string profileKey = "Profile.ProfileCommonType";
 		private static bool ProfileCommonTypeExists
 		{
 			get
@@ -90,7 +83,7 @@ namespace System.Web.Profile
 			set { AppDomain.CurrentDomain.SetData (profileKey, value); }
 		}
 
-		const string groupKey = "System.Web.Profile.ProfileGroupType";
+		const string groupKey = "Profile.ProfileGroupType";
 		private static bool ProfileGroupTypeExists
 		{
 			get