Skip to main content

ASP.Net MVC Basics, Framework Request Flow, Why should we use ASP.Net MVC and Pre-requisite for MVC

Model View Controller (MVC): The Model-View-Controller (MVC) design pattern is an architectural design pattern for any standard development that separates the components of an application. This allows applications to handle very flexible and extensible and easy to handle.

The MVC model defines web applications with 3 logic layers: i.e. the business layer (Model logic), the display layer (View logic), and the input control (Controller logic)

ASP.NET MVC Framework has three main components

1.   Model:  It is the part of the application that handles the logic for the application data. Often model objects retrieve data (and store data) from a database. This manages the behavior and data of the application domain, responds to requests for information about its state from the view, and responds to instructions to change state. Basically MVC Model contains all application logic (business logic, validation logic, and data access logic), except pure view and controller logic.

2.   View: It is the parts of the application that handles the display of the data. Most often the views are created from the model data. This represents the presentation layer of the web application (i.e. aspx page).

3.   Controller: It is the part of the application that handles user interaction. Typically controllers read data from a view, control user input, and send input data to the model. User request comes through the controller to model and manipulate the records from it and then render the data using View to UI.


ASP.NET MVC Framework Request Flow:

·         Client requests the server for processing of controller and action.
·         ASP.NET Routing finds the route match by calling RouteCollection.GetRouteData
·         The MVC controller factory locates and creates the controller in CreateController
·         The ControllerActionInvoker determines which action to run in InvokeAction
·         Controller processes client’s request and creates a data Model.
·         Model is passed to view for transformation.
·         View transforms Model into appropriate UI to send it back to the client.
·         Response (UI) is rendered to the client’s browser.

Why should we use ASP.net MVC?

·         Provides clean separation of concerns (SoC). The code organization within MVC is very clean, organized, and granular, making it easier for a web application to scale in terms of functionality. Promotes great design from a development standpoint.
·         MVC enables Test Driven Development (TDD). With MVC, you can more easily create tests for the web side of things. An additional layer of testing will provide yet another layer of defense against unexpected behavior.
·         MVC is great for Search Engine Optimization as you control the URL (though now you can achieve this in ASP.NET 4 as well).
·         Clean View Markup (no additional HTML emitted) and MVC enable full control over the rendered HTML.
·         SEO-friendly URL by design (though now this is possible in ASP.NET 4 as well)
·         No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
·         No ViewState and PostBack events, which eventually makes MVC faster in performance.
·         MVC follows the design of the stateless nature of the web.
·         Rich UI support (possible through client-side JS libraries like jQuery UI and others).
·         More power validation with DataAnnotations and jQuery.
·         Easy integration with JavaScript frameworks.
·         MVC is much easier to create very complex websites with a minimum of code.
·         MVC is not a replacement if ASP.NET Web Form-based development. This seat on the top of ASP.NET Development.

Pre-requisite for MVC: So we have learned some basic details about MVC, and now wanted to work on MVC application, so the question that comes to mind is MVC work on our existing platform or whether we need to enhance our development environment.

Here is the answer: To create a MVC application you need,

·         Visual Web Developer 2012 (If you have Windows 7 or Windows 8)

·         Visual Web Developer 2010 or the free Visual Web Developer 2010 Express. These include ASP.NET MVC 2 template by default. (If you have Windows Vista or XP)

·         Visual Studio 2008 SP1 (any edition) or the free Visual Web Developer 2008 Express with SP1. These do not include ASP.NET MVC 2 by default; you must also download and install ASP.NET MVC 2 from http://www.asp.net/mvc/.

Comments

  1. Your information about asp.net frame works is really interesting and innovative. Also I want you to share latest updates about this frameworks. Can you update it in your website? Thanks for sharing
    Dot net training institute in Chennai

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information




    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





    ReplyDelete

Post a Comment