In my project I have strongly typed viewdata in the spirit of the following:
AppleListViewData : ViewDataDictionary
+ SelectedTheme
+ ThemeList
+ SelectedApple
+ AppleList
Where the first four are re-occuring accross all the viewdatas because they are used in the site.master
To keep it DRY I elevated them into a BaseViewData class which the other inherit from.
Now all my controllers need to fill up these properties. Again, to keep it DRY I created a BaseController for my controllers that takes on this job.
BaseController : Controller
+ new ViewData : BaseViewData
+ FetchThemes
+ FetchSelectedTheme
The BaseController.ViewData is newed because it hides the Controller.ViewData All the controllers are responsible of newing up the viewdata at constructor time.
I'm essentially hiding the existing viewdata system and replacing it with my own.
This is where I feel I'm doing something wrong.
Any suggestions how I can make this work in a more elegant way?