I have multiple objects that inherit from a base class and am trying to decide how the user should edit them. There are many common fields and a few fields that only apply to each sub class. Is there a design pattern to address this?
I was thinking I could have one web page for each one or I could have a single web page and show/hide the fields for the subclass. I can think of pros and cons for each one. It’d be nice to know if there’s a standard way of handling it.
You could use parallel class hierarchies (which isn’t a design pattern in itself). Using this idea, you’d create a base code-behind class to cater for your base class’s properties and then create classes derived from this to support the necessary UI to handle the additional properties of your derived classes.
Parallel class libraries can lead to problems e.g. if you create a new derived class then you also have to create a new derived UI class etc, however if your derived UI classes are simple then this might not become too much of a problem.
Edit:
If this is the route you go down, you would want to create a hierarchy of user controls rather than pages, then add the appropriate user control to your page at runtime.