I\'ve been playing around with ASP.NET MVC with a site containing a Master Page.
I created an MVC user control called ProductThumbnailControl
. The user c
Looks like my solution is very similar to Microsoft's recommendation with one key exception. I was creatng a ViewData baseclass, and they create a Controller baseclass - which makes a lot more sense.
However it seems that both ideas could (and should) work in tandem. The MS tutorial below uses a dictionary to store view data, so if you had a strongly typed model you'd also need a baseclass for that.
Microsoft MVC tutorial
I would create a ShoppingCart Controller (or separate controllers for each concern) and render usercontrols that use them with RenderAction found in the Futures DLL that you can download from www.codeplex.com/asp.net. It is part of the ASP.NET MVC source code.
Using a base controller or a 'site model' couples too many things together, creating a testing and maintanence nightmare.
Our master page takes data from the view. We use strongly typed view names for our views and in the methods for that implementation we also add standard view data that every page needs from our persistent objects (like the application menu structure info, the user info to display on screen and so forth).
This does have the disadvantage of making our view data for the master page not strongly typed like it is for the Model object, but it works very well for us.
Your idea is also good. As the idea of the Master page is similar to the idea of inheritance, why not use inheritance to setup your model objects. You could take it a step further and create a model factory that produces your model objects and sets the base class data while it does so.