O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a navegar o site, você aceita o uso de cookies. Leia nosso Contrato do Usuário e nossa Política de Privacidade.
O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a utilizar o site, você aceita o uso de cookies. Leia nossa Política de Privacidade e nosso Contrato do Usuário para obter mais detalhes.
AHM Pervej Kabir
Cell:+8801757051005 Day-1: 06 September 2017
ASP.Net C#- MVC-5 Training
Request Response Process
Entity framework-EF Example
About Model –Viewer- Controller (MVC)
What is MVC?
MVC stand for Model-Viewer-Controller
It is software architectural pattern
o An architectural pattern is a general, reusable solution of a commonly occurring problem in
software architecture within the given context.
o Architectural pattern is similar to software design pattern but have a broader scope.
It divided an application’s implementation in three components (Model, Viewer and controller)
The Model represent the application core (for instance a list of database records)
The view displays the data (the database records)
The controller handles the input.
Model –Viewer- Controller (MVC) Design Goal
Separation of Concern
“The process of breaking a computer program into distinct features in functionality as little as possible “-
Responsibility of Model, viewer & controller are separate
Embrace the web
Able to adopt the standard web technology HTML, CSS, CSS3 etc.
Run on Asp.Net
Run on top of Asp.Net run time
Use different plugins and changes as you like
MVC design to allow loosely couple & solid object oriented concept
Any solution & code designed in the fashion is testable
MVC Logic Layer
You can think MVC Model defines web applications with 3 logic layers
o The business layer (Model logic)
o The display layer (Viewer logic)
o The input control (Controller logic)
The Model is the part of application that handles the logic for the application data
o Often Model objects retrieve data ( and store data ) from a database.
The View the part of application that display data
o Most often Views are created from the Model data.
The Controller is the part of application that user interaction
o Typically The Controller read data from the view, control user inputs and inputs data to the
The MVC separation helps to manage complex applications because you can focus on one aspect of a time.
o For example, you can focus on the view without depending on the business logic .
o It all makes essayer to test an application
The MVC separation also simplifies group development
o Different developers can work on the view, the controller logic and the business logic in parallel.
What is view engine?
The view engines are responsible for rendering the HTML from views to the browser.
The view engines template will have different syntax for implementation.
Currently few number of view engines are available for Asp.net-MVC and top four are RAZOR, Traditional
ASPX, SPARK and Nhaml.
MVC Request and Response Process
ASP.Net MVC Request response process step by step following bellow-
1) User send the request by the URL
2) UrlRoutingModule intercepts /cut offs the request and starts parsing it.
3) The appropriate controller and handler will be identified from the URL by looking at the routing table
collection. Also any data coming alone with the request is kept in RouteData.
4) The appropriate action in the identified controller will be executed.
5) The action will call the model class based on data
6) The action will then pass to some view and tell the view to proceed
7) Now the view will execute and create the markup based on logic and model’s data then push the
HTML back to the browser