After performing a Pivot in SQL I end up with a datasource with a few known columns and a variable amount of unknown (at design time) columns.
I used the classic DataSet - DataTable solution, but started hitting OutOfMemory exceptions while processing the data (60,000 rows and 95 columns).
I then realized I needed a lighter weight solution and so used Reflection.Emit to construct my types at runtime. This worked perfectly giving me a 10x performance increase over the DataTables, however, the processing code was quite complex, so for simplicity sake I changed the code to generate a type that inherits from a defined base type where the base type contains the known columns and I used Reflection.Emit to define a new type extending the base class and adding the extra columns at run time.
This simplified the code nicely and I can construct and fully populate these objects correctly.
The problem is that when I bind them to a DataGrid, only the base type's columns are visible. If I add a reference to the object in the debugger I can also only see the properties of the base class (Grid.DataSource(0)), however if I check the type I can see all the properties are there - Grid.DataSource(0).GetType.GetProperties().
Anyone know why the DataGrid and other data visualizers refuse to find these added properties?