Kevin Dente's Blog

The Blip in the Noise
CodeGen and Partial Classes

During a recent chat session on debugging with Visual C#, the following questions and answers came up:

Q: Will generated classes from tools such as xsd.exe and wsdl.exe (and the equivalent in IDE) produce partial classes?
A: We are still identifying code gen areas where it makes sense to create partial classes. I'll pass your suggestion on.

Q: Wouldnt it make sense to always gen partial classes? I cant think of any reason why you would NOT want this.
A: Agreed. Unfortunately, although the compiler supports partial classes, the work in the IDE and debugger to support them is still ongoing. For instance, how do we present partial class source files in Solution Explorer? Into which partial class source file do we insert genned code? ETc, etc. (BTW, this is not to say we don't have answers, but like most things, the answers have to be refined.)

I'll add a big +1 to the request for partial class support in the .NET codegen tools. I'd love to be able to add some smarts to web service proxy classes without having to worry about refresh wipe-outs.

 

Published Monday, January 5, 2004 2:29 PM by kevindente

Comments

# re: CodeGen and Partial Classes@ Monday, January 5, 2004 5:57 PM


Thanks for following up on my inquiry. I have also posted this question to a few other members on the team. Hopefully it will be addressed.

Rob Chartier

# re: CodeGen and Partial Classes@ Tuesday, January 6, 2004 4:08 AM

For showing classes in the solution explorer: you don't do that anymore. A piece of code is stored in a file, yes, but it can belong to a bigger piece of code, like 3 fragments of a class in 3 files make up 1 class. So you should work with the CLASS, not with the FILES. The file should not be the item you work with, it's silly, you work with code, classes, not with files.

The same weirdness is seen in Visio. You're modelling an ORM model and you work with PAGES. Erm... why? It's 1 model, why do I have to work with sheets of paper...

Frans Bouma