Author: krasnov
Date: 2007-03-14 11:45:09 -0500 (Wed, 14 Mar 2007)
New Revision: 74267

Modified:
   trunk/mcs/class/System.Web/System.Web.Profile/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs
Log:
* ProfileParser.jvm.cs: performance optimization

Modified: trunk/mcs/class/System.Web/System.Web.Profile/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Profile/ChangeLog     2007-03-14 
16:34:25 UTC (rev 74266)
+++ trunk/mcs/class/System.Web/System.Web.Profile/ChangeLog     2007-03-14 
16:45:09 UTC (rev 74267)
@@ -1,3 +1,7 @@
+2007-03-14  Vladimir Krasnov  <[EMAIL PROTECTED]>
+
+       * ProfileParser.jvm.cs: performance optimization
+
 2007-01-18  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * ProfileModule.cs: fixed OnLeave, AutomaticSaveEnabled should be

Modified: trunk/mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs  
2007-03-14 16:34:25 UTC (rev 74266)
+++ trunk/mcs/class/System.Web/System.Web.Profile/ProfileParser.jvm.cs  
2007-03-14 16:45:09 UTC (rev 74267)
@@ -45,27 +45,63 @@
 
                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 
(resolvedUrl, false);
+
+                               ProfileCommonTypeExists = profileBaseType != 
null;
                        }
                        return profileBaseType;
                }
 
                public static Type GetProfileGroupType (HttpContext context, 
string groupName)
                {
+                       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 ('/');
+                               string resolvedUrl = 
System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute 
(virtualPath).TrimEnd ('/');
                                profileGroupType = PageMapper.GetObjectType 
(resolvedUrl, false);
+
+                               ProfileGroupTypeExists = profileGroupType != 
null;
                        }
                        return profileGroupType;
                }
+
+               const string profileKey = 
"System.Web.Profile.ProfileCommonType";
+               private static bool ProfileCommonTypeExists
+               {
+                       get
+                       {
+                               object o = AppDomain.CurrentDomain.GetData 
(profileKey);
+                               if (o == null)
+                                       return true;
+                               return (bool) o;
+                       }
+                       set { AppDomain.CurrentDomain.SetData (profileKey, 
value); }
+               }
+
+               const string groupKey = "System.Web.Profile.ProfileGroupType";
+               private static bool ProfileGroupTypeExists
+               {
+                       get
+                       {
+                               object o = AppDomain.CurrentDomain.GetData 
(groupKey);
+                               if (o == null)
+                                       return true;
+                               return (bool) o;
+                       }
+                       set { AppDomain.CurrentDomain.SetData (groupKey, 
value); }
+               }
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to