ASP.NET MVVM and Other Frameworks


ASP.NET MVC implements the MVC Model 2. There is a front controller that coordinates all of the requests that are made to the Web application. The process sequence is from the controller to model to view.

The Presentation Model pattern implements the standard MVC interaction flow, like other variations of MVC pattern, such as MVP. The user interacts with the view, and actions (such as a button click) are captured by the view and forwarded to the controller. The process sequence is from the view to controller to model.

ASP.NET web form programming model is standard MVC out of box. The Presentation Model pattern runs naturally on top of the ASP.NET. It can leverage all ASP.NET features such as the web form, user control, server side event driven and view states.

It is possible and would be interesting to add URL Routing to The Presentation Model pattern. Let’s see how the URL Routing will work in ASP.NET 4.0.

2. Model View Presenter

MVP is another MVC variation. There are two MVP's out there - Supervising Controller and Passive View. While MVP doing the job of separating the responsibilities of UI layer and Data Layer, and supporting unit test, it does not leverage many advanced features on Microsoft platform, like user controls and two way data binding in ASP.NET, WPF and Silverlight. If building application using user controls, each user control needs to have a presenter class. Unlike the Presentation Model, the Presenter is usually not shared between the Views. There is no communication between Presenters.

From my point of view, the ASP.NET could be MVP out of box, if the Visual Studio designer generated the code behind code to have an interface and an aggregated presenter class, not the inherited class.

3. Unity and Other IoC Frameworks

Unity and other IoC frameworks can be used to implement Dependency Injection function for the Presentation Model. Usually they have their own containers to store object references. The ASP.NET MVVM framework differs to them in the way of that it stores object references in ASP.NET Application, Session, Request and in the control tree.

Last edited Mar 16, 2009 at 9:26 PM by yysun, version 1


No comments yet.