I have a project which loads from database a XML file which defines a form for some user. XML is transformed into a collection of objects whose classes derive from single parent. Something like
Control -> EditControl -> TextBox
Control -> ContainterControl -> Panel
Those classes are responsible for creation of GUI controls for three different enviroments: WinForms, DevExpress XtraReports and WebForms. All three frameworks share mostly the same control tree and have a common single parent (Windows.Forms.Control, XrControl and WebControl).
So, how to do it?
Solution a) Control class has abstract methods
Control CreateWinControl(); XrControl CreateXtraControl(); WebControl CreateWebControl();
This could work but the project has to reference all three frameworks and the classes are going to be fat with methods which would support all three implementations.
Solution b) Each framework implementation is done in separate projects and have the exact class tree like the Core project. All three implementations are connected using a interface to the Core class.
This seems clean but I'm having a hard time wrapping my head around it. Does anyone have a simpler solution or a suggestion how should I approach this task?