In a reporting application, I have a number of different types of graphs, each of which is output with code in a specific class. Eg. clsPieChart, clsBarChart, etc. Each of those is derived from a base class, clsChartBase.
Now, the report can be put together dynamically, so there is a string ID code in the database for each type of chart, eg. "pie", "bar", etc.
My solution has been to use a common static variable in each class to match it up with the database code, eg:
Class clsPieChart
Inherits clsChartBase
Public ReadOnly Shared _ChartID As String = "pie" ' Each class has one of these.
This is how I can identify which class needs to be instantiated to handle that part of the report. Is this a reasonable approach, or is there a better way to do this sort of thing?