How to work MVC Framework

How to work MVC Framework

An ASP.NET MVC application is an application which depends upon the ASP.NET MVC Framework. MVC stands for Model, View Controller, the three components which define an application created using the MVC pattern.

The MVC pattern aims to seperate an applications logic, data and presentation into distinct, somewhat independent components.

1) Model

Models are a representation of an application’s data. For example a shopping application might have a Cart model to represent the state of a user’s shopping cart.

2) View

A view is a visual representation of the data contained in the model. A view class should knoow the specifics of how the model(s) it uses should be presented.

3) Controller

The Controller’s job is to handle user input and update the state of the Model to reflect the changes that were made as a result of user action. For example imagine the user is viewing a Contact Us page and clicks the Submit button. The controller would respond to the button click by updating the model with values from the form fields and then save the model, causing it to be validated and then written to the database.

This is a very shallow and incomplete explaination of the MVC pattern you should head over to the ASP.NET MVC homepage to get a more complete view of the MVC pattern and the ASP.NET MVC framework.

An ASP.NET Web Application uses a separate framework known as Web Forms. Because Web Forms does not use the conventions defined in the MVC pattern, the Web Application template does not create a similar folder structure .

The use of either framework is not mutually exclusive, the two represent differing approaches to the same problem. With respect to which is most efficient for data access I would refere you to Michael Shimmins’ excellent comment

You may also like...

Leave a Reply