Dear MICROSOFT, more details on Partial Types, PLEASE.....

G

Guest

Ok, I asked this question before and I also looked at the book "First Look
at ASP.NET 2.0"
I also read Paul wilson's web page explanation. HOWEVER......

The book and that web page talks about partial types and that IF you have a
Extends keyword, I think, before the class name AND the same Namespace, .NET
will automatically compile the rest of the class that is located in another
file.

However, I want to know just exactly how is .NET going to find that OTHER
file......

There is the .aspx page that has the complieswith attribute and some other
attribute that can as before look for the CodeBehind file.

However, just exactly how does .NET find the other FILE????????

Does it search first and READ every single FILE in the same directory and
work it's way out to the other files within the application to find a class
name and namespace that matches?
 
G

Guest

You don't understand what I am getting at.

There are at least THREE (3) files in a partial type.

(1) MyPartialType.aspx file <-- .aspx web page

(2) MyPartialType.aspx.cs file <-- standard code behind already referenced
in the (1) above

(3) MyPartialTypeWhereAmI.aspx.cs <----- file that I don't know how .NET
knows where it's at????????


How does it, .NET, know where (3) is?????????????
 
G

Guest

"Build Code"? or do you mean, "Do I build code with VS.NET?"

All I want to know is how does .NET find #3.
 
G

Guest

Partial Types are needed when you want to do a LOT of STUFF

I just want to know how .NET find the third file #3( the one that's who's
path is not given on the .aspx or code behind file, that's all.
 
C

Cor

Hi Nospam,

First of all, this Public newsgroups is not Microsoft. There are Microsoft
people participating and Microsoft people checks themself for intresting
things and totaly bad behaviour in this Newsgroups, but it is never
Microsoft who answers, it are always individuals, even if they are from
Microsoft.

But to help you, maybe this first row from the aspx page will tell you
something

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="WebApplication1.WebForm1"%>

The code behind is clear I think and it Inherits the WebForm1 class, which
itself inherits the System.Web.UI.page when you see that.

The user does not see it, because when it is send, this information is not
sended.

I hope this helps you a little bit.

Cor
 
R

Ron McNulty

Hi nospam

Considering your apparent dislike of OO techniques, and your embracement of
the KISS principle, why would you be using partial types?

Personally I have NEVER found the NEED for them (or capitals in every line)
:)

Regards

Ron
 
W

Wim Hollebrandse

Partial types use the 'partial' keyword.

So your source file MyPartialType.aspx.cs would contain something like:

public class partial WebForm1 : Page
{
// code...like Page_Load etc..
}

And your MyPartialTypeWhereAmI.aspx.cs file would contain:

public class partial WebForm1 : Page
{
// some other code...but still part of WebForm1 class...
}

So the compiler finds this because of the partial keyword. All partial classes with the same class name end up being compiled into one class.

Hope that helps.

Regards,
Wim Hollebrandse
http://www.wimdows.net
http://www.wimdows.com
 
M

Michael Giagnocavo [MVP]

".NET" doesn't find them. The compilers / environment will find them and
compile them into one class. Rather simple.
-mike
MVP
 
G

Guest

What about J.I.T. then?

Say if I hit F5(Refresh) within Internet Explorer for a single .aspx page
that has 2 .cs files as it's code behind files using compilesWith=
attribute, now what?

See what I am getting at? JIT is what I want to know....
 
C

Cor

Hi Nospan,

Aspx returns no server side aspx page and either aspx.cs but a created HTML
page with an extention ASPX.

Therefore client side debugging is not the same as serverside debugging.

I hope this helps a little bit.

Cor
 
G

Guest

Sorry that doesn't help.


Here is the question again.

What about J.I.T. then?

Say if I hit F5(Refresh) within Internet Explorer for a single .aspx page
that has 2 .cs files as it's code behind files using compilesWith=
attribute, now what?

See what I am getting at? JIT is what I want to know....

When I hit F5, how is .NET going to know where that OTHER
"MyPage_FIND_ME.aspx.cs" file is going to be
in other to fully compile the .aspx page..

Understand....there are 3 pages, 1 aspx page, and 2 .cs pages
 
M

Michael Giagnocavo [MVP]

The compiler looks for them when it recompiles (if it's working for you).

And what JIT are you talking about? By itself, J.I.T. means "just in time".
The JIT compiler? That acts upon the compiled CS (MSIL), and happens at a
much later stage.
-mike
MVP
 
G

Guest

When you hit the .aspx page the FIRST time, it's JIT'ed, right? Compiled
right?

That's what I am talking about. I got 3 files, 1 .aspx and 2 .cs files that
make up the code behind for that single .aspx page.

Understand now?

I don't see why people are so confused on what I am asking. It's real
simple.

A single .aspx and single code behind page is NOW a single .aspx page and
TWO code behind pages.

What's so difficult on that one???
 
G

Guest

Thanks, HOWEVER it doesn't seem to answer the question


Untitled.aspx
Untitled.aspx.1.cs
Untitled.aspx.2.cs

These three files must be used together to make Untitled.aspx page work via
JIT when the User first hits Internet Explorer 6.0 on your browser

YES, NO, does anyone understand what I am asking?????????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top