Hello.
I am generating a class that contains MANY properties on it (around 150) using the CodeDOM API. This class is basically an object that represents a row found in an Excel worksheet.
The code for generation investigates the target worksheet, extracts the header row based on user-input, and generates the row class. Additionally, the generation process decorates each property with a column binding attribute, which I've defined in our code base.
Output example:
public partial class Row
{
[ColumnBinding("A")]
public string CustomerName {get;set;}
[ColumnBinding("B")]
public string CustomerNumber {get;set;}
...
}
Now, here's the problem: I want to decorate a subset of these properties with an OPTIONAL attribute that I will insert manually at design time. The class I'm generating is partial, so I already tried mirroring a property and decorating the property on the non-generated class with a different attribute, but that obviously didn't work.
Does anyone have any ideas concerning this problem? I've thought about it for a while now, and the only thing I can think of is to store the metadata for worksheet rows in a data store somewhere, and then generate the row class. However, I don't really have the time execute this right now.
Thanks.