* PageCompiler.cs, BaseCompiler.cs: refactoring: moved the
authorMarek Habersack <grendel@twistedcode.net>
Fri, 9 Mar 2007 23:44:19 +0000 (23:44 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Fri, 9 Mar 2007 23:44:19 +0000 (23:44 -0000)
CreateProfileProperty and InternalCreatePageProperty to
BaseCompiler from PageCompiler.

* GlobalAsaxCompiler.cs: generate the Profile property for the
Global_asax class.

svn path=/trunk/mcs/; revision=74036

mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs

index 2b0e78c9091034cee0aaf9b6dc52c3f5ee34bb83..7da8ee0ed7f5109843f0834aebc9aac5f2402cda 100644 (file)
@@ -222,6 +222,41 @@ namespace System.Web.Compilation
                {
                }
 
+#if NET_2_0
+               void InternalCreatePageProperty (string retType, string name, string contextProperty)
+               {
+                       CodeMemberProperty property = new CodeMemberProperty ();
+                       property.Name = name;
+                       property.Type = new CodeTypeReference (retType);
+                       property.Attributes = MemberAttributes.Family | MemberAttributes.Final;
+
+                       CodeMethodReturnStatement ret = new CodeMethodReturnStatement ();
+                       CodeCastExpression cast = new CodeCastExpression ();
+                       ret.Expression = cast;
+                       
+                       CodePropertyReferenceExpression refexp = new CodePropertyReferenceExpression ();
+                       refexp.TargetObject = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Context");
+                       refexp.PropertyName = contextProperty;
+                       
+                       cast.TargetType = new CodeTypeReference (retType);
+                       cast.Expression = refexp;
+                       
+                       property.GetStatements.Add (ret);
+                       mainClass.Members.Add (property);
+               }
+               
+               protected void CreateProfileProperty ()
+               {
+                       string retType;
+                       ProfileSection ps = WebConfigurationManager.GetSection ("system.web/profile") as ProfileSection;
+                       if (ps != null && ps.PropertySettings.Count > 0)
+                               retType = "ProfileCommon";
+                       else
+                               retType = "System.Web.Profile.DefaultProfile";
+                       InternalCreatePageProperty (retType, "Profile", "Profile");
+               }
+#endif
+               
                protected virtual void AddInterfaces ()
                {
                        if (parser.Interfaces == null)
index dc5c88ec511133706c4d9c95410bab99bf1fdb74..58c6abaf10cd58354efc7a5fc4584cd55a8b4237 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-10  Marek Habersack  <mhabersack@novell.com>
+
+       * PageCompiler.cs, BaseCompiler.cs: refactoring: moved the
+       CreateProfileProperty and InternalCreatePageProperty to
+       BaseCompiler from PageCompiler.
+
+       * GlobalAsaxCompiler.cs: generate the Profile property for the
+       Global_asax class.
+
 2007-03-09  Marek Habersack  <mhabersack@novell.com>
 
        * AppCodeCompiler.cs: Add the GetProfile method to the
index 09a11b1c5c01a2e42c9492ffc1706228e73b203b..7a28a145a48bc45438ff9682f05ad700e78b562f 100644 (file)
@@ -57,7 +57,10 @@ namespace System.Web.Compilation
                protected internal override void CreateMethods ()
                {
                        base.CreateMethods ();
-
+#if NET_2_0
+                       CreateProfileProperty ();
+#endif
+                       
                        ProcessObjects (parser.RootBuilder);
                }
 
index 314d0c12b3f734cf8a744b3ed442e79d6972d4c3..0dad3cc7d5de1f9939fdd500b227b67f5667c358 100644 (file)
@@ -89,41 +89,6 @@ namespace System.Web.Compilation
                        mainClass.Members.Add (method);
                }
 
-#if NET_2_0
-               void InternalCreatePageProperty (string retType, string name, string contextProperty)
-               {
-                       CodeMemberProperty property = new CodeMemberProperty ();
-                       property.Name = name;
-                       property.Type = new CodeTypeReference (retType);
-                       property.Attributes = MemberAttributes.Family | MemberAttributes.Final;
-
-                       CodeMethodReturnStatement ret = new CodeMethodReturnStatement ();
-                       CodeCastExpression cast = new CodeCastExpression ();
-                       ret.Expression = cast;
-                       
-                       CodePropertyReferenceExpression refexp = new CodePropertyReferenceExpression ();
-                       refexp.TargetObject = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Context");
-                       refexp.PropertyName = contextProperty;
-                       
-                       cast.TargetType = new CodeTypeReference (retType);
-                       cast.Expression = refexp;
-                       
-                       property.GetStatements.Add (ret);
-                       mainClass.Members.Add (property);
-               }
-               
-               void CreateProfileProperty ()
-               {
-                       string retType;
-                       ProfileSection ps = WebConfigurationManager.GetSection ("system.web/profile") as ProfileSection;
-                       if (ps != null && ps.PropertySettings.Count > 0)
-                               retType = "ProfileCommon";
-                       else
-                               retType = "System.Web.Profile.DefaultProfile";
-                       InternalCreatePageProperty (retType, "Profile", "Profile");
-               }
-#endif
-
                static CodeAssignStatement CreatePropertyAssign (CodeExpression expr, string name, object value)
                {
                        CodePropertyReferenceExpression prop;