New code separation model coming in beta 2
.Net 2.0
Thread Starter: Paschal
Started:
Replies: 0

Ireland .NET Developer Alliance :: Forums » Technologies » .Net 2.0 » New code separation model coming in beta 2
Next Thread »
   19 Jan 2005, 1:29
Paschal is not online. Last active: 11/02/2005 15:00:30 Paschal

Top 10 Posts
Joined on 27-10-2004
Posts 84
New code separation model coming in beta 2
The change boils down to this - the class you define in your separate code file is no longer merged as a partial class with the .aspx-generated class definition, but rather with another intermediate partial class generated for you that contains protected member variable declarations of server side controls. Interestingly, it's no longer code-beside (a term that Microsoft never endorsed anyway) but really code-up-to-the-left-and-adjacent-to :) Perhaps we should call it code-diagonal...
 
Syntactically, here's what the change looks like. In beta1 you created a partial class and referenced it in your Page directive like so:
 
<%@ Page compilewith="mypage.cs" classname="mypage" %>
 
where mypage.cs looks something like:
 
public partial class mypage
{
  //...
}
 
this changes in beta2 to the following:
 
<%@ Page inherits="mypage" codefile="mypage.cs" %>
 
where mypage.cs now looks something like:
 
public partial class mypage : System.Web.UI.Page
{
  //...
}
 
Yes, you read that right - the 'inherits' keyword is back, and you are back to authoring the base class for your .aspx-generated class definition again. The difference between this and 1.1 is that you no longer have to declare protected/public member variables whose names match the ids of the controls in the .aspx file. This is apparently done in another intermediate base class that is created as a partial class and combined with your partial class declaration to give you access to the controls in the same way you do in the beta 1 release.

  
  Page 1 of 1 (1 items)
Ireland .NET Developer Alliance :: Forums » Technologies » .Net 2.0 » New code separation model coming in beta 2

Powered by Community Server :: Forums