Thinking about partial classes
I'm thinking about the way ASP.Net are working, and I can't help thinking that I'm missing something with regard to partial classes. The issue here is that of how the compiler knows to take the aspx page and turn it into code.
Is it done it the compiler level in the first place? If so, how does the compiler knows about it? Is it possible to get your own code to run when this is done?
I think that the answer to those is no, and that it is just the magic of ASP.Net & VS.Net that make it looks like it's happening. And ideas about it? I'm interested in generating add-on content for a class during compilation, and I think that partial classes and attribute based code generation might put me on an more even footing on C# as I am on Boo.
Right now it looks like I need to:
- Write a Custom Tool to do it, and register as a pre compilation step in VS.Net (MsBuild?)
- Parse the source files, in order to figure out which class has the correct attributes. Any suggestions on how to do that? I need to do it before compilation.
- Spit out gobs of code.
The part about parsing worries me, it not going to be pleasant to do, and I can't think of an easy way to get the AST for a C# file.