Introduction to MVP Web Forms


The MVP Web Forms is a framework which gives basic structure for your enterprise applications. It has implementation of MVP (Model-View-Presenter) pattern and multi layered structure with dependency injection handled. Framework allows developers to perfectly separate responsibilities across components as well as layers.


MVP Brief


Responsibilities are separated accross four components: View, view interface, presenter, and model. the view is responsible for rending UI elements, the view interface is used to loosely couple the presenter from its view, the presenter is responsible for interacting between the view/model, and the model is responsible for business behaviors and state management.



MVP Web Forms Values



The Need for MVP


Consider you have a form that has to be composed out of several different controls or parts. Also form will contain some of the UI logic and data. In such cases, The Model View Presenter patterns describes a way to separate out the visual elements from the logic and the data.


Model

The model typically is the data of your application. Model carries data through levels of the application. Model might hold data from a database or results from a web service etc.

View

The View is simply a user control or a form in user interface.

Presenter

The presenter contains minimal logic. View and model has no logic. So view responsible for updating view and model. Key point is, Presenter communicates to the view through an interface. With this way presenter and the model can be isolated.


Flow


User events from a view are sent to presenter. Presenter updates model. Model trigger state change event in presenter. Presenter updates view.