I have a console app, the central process of which is to get the next line from a DB table, and based on a field value, run one of several bits of code which all return the same type o object. I could have a switch or if statement type arrangement, which does something like (pseudo code):
if exhibitType == "Summary" then AddSummaryExhibit
elseif exhibitType == "Timeline" then AddTimelineExhibit
... etc. Almost like the routing setup in MVC websites. This program does follow an approximate MVC type structure, with each method getting data from a model, rendering HTML based on a .cshtml razor view and appending it to a collection of 'sections' that belong to a HTML document container.
Ideally it'd be nice just to add a new method of name x to my project and then allow x to be added as a new value in the db table without having this manually maintained set of conditionalities. I was thinking maybe delegates or somesuch might apply here, but that's just a thought. Any tips on best practice would be appreciated.
Thanks