Attributes (and descriptions) of properties in generated partial classes

Hi

When a generator creates properties in a partial class it usually doesn't know anything about the attributes the application will need on these properties.

I could manually set the attributes after the code is generated. But they would be lost as soon as I need to regenerate the code.

The best solution would be partial (stub) properties in a peer partial class that is not generated and thus never destroyed. But they do not exist in framework 2.0.

Any idea how to come out of this dilemma.

orbit

[513 byte] By [orbit] at [2008-2-8]
# 1

If you have control of the generator, make the properties virtual. Then simply derive from the partial class and override the properties. You can then place attributes to your heart's content without worrying about them being overwritten.

However, if you don't have control of the generator I can't think of a way to apply the attributes.

DavidM.Kean at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified