Introduction to mvc architecture


Published on

Introduction to mvc architecture

Published in: Internet, Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to mvc architecture

  1. 1. MVC TRAINING DAY-1 1 QuicSolvTechnologiesPvt.Ltd.
  2. 2. INTRODUCTION TO MVC ASP.NET ARCHITECTURE  ASP.NET MVC is a part of ASP.NET and not an entirely separate Framework.  The Model-View-Controller (MVC) pattern is an architectural design principle that separates the components of a Web application. This separation gives you more control over the individual parts of the application, which lets you more easily develop, modify, and test them.  ASP.NET MVC is part of the ASP.NET framework. Developing an ASP.NET MVC application is an alternative to developing ASP.NET Web Forms pages; it does not replace the Web Forms model. 2 QuicSolvTechnologiesPvt.Ltd.
  4. 4. MODEL-VIEW-CONTROLLER  Controller: - The controller is like a traffic cop. Whenever user requests any resource it first goes to the controller. Controller than interact with both the Model and View.  Model: - The model is responsible for the data for the application and also it creates data for the view. It handles data processing and database works part.  View: - It is a presentation layer i.e. it shows the data to the users. 4 QuicSolvTechnologiesPvt.Ltd.
  5. 5. BASIC CONVENTIONS IN ASP.NET MVC  There is single controller directory which holds your controller classes.  Each controller’s name ends with “Controller” e.g. : HomeController  Views that controller use live in subdirectory of the Views main directory. Directory for above HomeController will be “Views/Home”  All reusable UI elements live in similar structure above but in a “Shared” directory on Root. 5 QuicSolvTechnologiesPvt.Ltd.
  6. 6. BASIC CONVENTIONS IN ASP.NET MVC  Controller contains all Controller classes.  Models contains all Models classes.  Views contains associated views.  Content contains all CSS / Images / other libraries  Script contains default scripts loaded MVC 6 QuicSolvTechnologiesPvt.Ltd.
  7. 7. 7 QuicSolvTechnologiesPvt.Ltd. ASP.NET WEB FORMS VS ASP.NET MVC  ASP.NET WeB Form  Does well with Abstraction  Not fully Testable  Not much HTML Expertise required  Less maintainable  Supported by heaps of third party Server side controls and tools.  ASP.NET MVC  Works with SoC principle  Best for TDD  HTML knowledge is required  Highly maintainable  Supported by various Third party JavaScript controls
  8. 8. ASP.NET MVC – VIEW ENGINE 8 QuicSolvTechnologiesPvt.Ltd.  Types of View Engine  System.Web.Mvc.WebFormViewEngine  System.Web.Razor  Bellevue  Brail  NDjango using the F#  Many More….
  9. 9. WHY VIEW ENGINES  Syntax  Skill set/background  Productivity  Testability  View engines that don’t depend on the System.Web.UI.Page are easier to test than the default ASP.NET MVC view engine, which uses Page for a base class of its view implementation.  Division of labor  If you have designers working on the views, or just want minimal logic in your views, you should choose a view engine that easily mixes with Html.
  10. 10.  Step 1 ASP.NET MVC REQUEST FLOW Incoming request directed to Controller Request Controller
  11. 11.  Step 2 ASP.NET MVC REQUEST FLOW Controller processes request and forms a data Model Request Controller Model
  12. 12. ASP.NET MVC REQUEST FLOW  Step 3 12 QuicSolvTechnologiesPvt.Ltd. Model is passed to View Request Controller Model View
  13. 13. ASP.NET MVC REQUEST FLOW  Step 4 13 QuicSolvTechnologiesPvt.Ltd. View transforms Model into appropriate output format Request Controller View Response
  14. 14. ASP.NET MVC REQUEST LIFE CYCLE 14 QuicSolvTechnologiesPvt.Ltd.
  15. 15. WHY MVC?  It makes it easier to manage complexity by dividing an application into the model, the view, and the controller.  It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.  It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure. For more information, see Front Controller.  It provides better support for test-driven development (TDD).  It works well for Web applications that are supported by large teams of developers and for Web designers who need a high degree of control over the application behavior. 15 QuicSolvTechnologiesPvt.Ltd.
  16. 16.  ANY QUESTIONS??????????? 16 QuicSolvTechnologiesPvt.Ltd.
  17. 17.  THANK YOU 17 QuicSolvTechnologiesPvt.Ltd.