I have a DB and I created classes to access/manage it using SQLMetal
. Now, I use LINQ to SQL, and I want to display the result of queries in a data grid view. when I do that, the columns are named after my columns in the DB table, and all the properties are displayed. I know I could change this by using DisplayName
and Browseable
attributes, but because the classes are auto-generated I can't just add this attributes where there are needed. I came up with three workarounds:
- creating an
Adopter
to adopt my classes. I'm still not sure how exactly you make an adopter for this case. - creating another program that will run after the generating of the code that will add the attributes. this seems like an hack, and I prefer to separate between the functionality and the GUI, so this method is on hold.
- using the
MetaDataType
attribute. I couldn't get this to work, and it's requires, as far as I know, that the classes and the metadata class will be in the same DLL.
How do I do the customization? is there another way? what way should I take and how?
EDIT: forgotten to mention: I'm using winforms, but if it will simplify things, I will move to WPF.