On a previous project I used single root inheritance for my MVC viewModel.
Everything worked and was effective at giving data to the Site master, but was a bit of a pain in the controller actions. To properly construct the root view data each time, we had to override (using method hiding) Controller.View().
I'm tempted to try attribute ViewData injection this time, and was wondering if anyone knew of any pitfalls to this approach.
This technique involves letting the action method set the ViewData.Model, then using an attribute to set a ViewData item for data destined for use by the Site master. I can strongly type the retrival with ViewDataDictionary extension methods.
Any help is greatly appreciated.
UPDATE: I'm going down the filter injection approach and it feels cleaner than the other ways. much cleaner. I got my IoC Container to property inject into the filters to give them the necessary providers they need for building Site-wide common data. While I have to write a Filter AND a helper method for each "thing" i want to be common, it frees up the construction of Model data in the controller actions.
Anyone else gone down this path too?
UPDATE 2: Yay! I think I stumped Stackoverflow