I'm making a WPF application that is comprised of Screens (Presenter + View). I want to be able to declare these screens in a config file or SQL database. I have been trying to come up with a good solution I've given up and am asking how some of you design this sort of thing? I've been working at this for over a week and every solution I come up with stinks.
In my WPF application I have a treeview that represents screens. When the user clicks on a node, the screen is loaded. I want to be able to populate the treenodes from a config file or database. The program should not care where these are stored so I can swap out a config store for a database store. If I have the screen info stored I can also use an IOC container to instantiate the screens for me and retrieve them by name. Here is a sample of the config file schema that I have come up with:
<screen name="" title="" presenterType="" viewType=""/>
<screen ...>
<screen .../>
<screen .../>
</screen>
<screen .../>
The latest solution I have come up with is to use a ScreenService that asks a ScreenRepository for ScreenInfo objects. Then I will be able to populate the treeview and IOC container with this information.
Does this sound like a good solution? What would you do different? And, how do you design this sort of system in your own programming?