Edit This Entry

santosh wrote this blog titled "What is MVC Architecture in ASP.Net?"

The MVC architectural pattern is very old pattern in software engineering which almost all programming languages implement with some variations. 

MVC stands for Model, View and Controller. It separates application into three components - Model, View and Controller with each having clearly defined responsibility.

Model: M of MVC - Model represents shape or structure of the data. This contains all business logic as well. All data of application should be maintained in Model.  Model objects are defined to retrieve and store model state or data in a database. In summary, Model is both data and business logic.

View: V of MVC - View is a user interface where users interact with software by providing input or viewing data fetched from database based on the query. View displays data using model to the user and also enables them to modify the data. In summary, view is User interface which is primarily static and dynamically generated HTML.

Controller: C of MVC - Controller handles the user request. User provides input to view which raises appropriate URL request and invokes controller based on Route mapping. The controller get data and renders the appropriate view with the model data as a response. In controller, various action methods will be there which will instatiate object of Model classes and then will load appropriate view. In summary, Controller is request handler. We should not write any business logic in Controllers.

 


Be the first to write your comment!


Current rating:

Comments