Consider 2 options for a real application for which you want to build a model, a composite model, if necessary, from a variety of sources for which strictly typed representations are used:
Create a new custom class for the model with a property for each piece of information that should be passed to the viewing stage,
Limit the models to the source classes of the domain and connect several controllers when using Html.RenderAction.
The disadvantage of option 1 is the need to create many "plumbing" classes. The downside of option 2 is the dirty sense of breaking the separation of problems and the more specific problem of tracking controller chains to find the one that selected a certain piece of HTML.
Before ASP.Net MVC, I had been using Maverick.Net for many years, and with it the model was a piece of XML code for the XSL lookup phase. In ASP.Net MVC, which would be the equivalent of passing the model to the presentation stage as a set of key value pairs in the ViewDictionary. The disadvantage of this is that key key name checks are not performed, but in my experience, key names change very rarely.
An interesting proposed solution to this problem is to invent dynamic partial classes .
So, a strongly typed view with ASP.Net MVC is used - a poor approach for composite models and a better, simpler and more efficient way to use the rude ViewDictionary approach?
source
share