1. MVC TRAINING DAY-1
2. INTRODUCTION TO MVC ASP.NET
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.
3. INTRODUCTION TO MVC ASP.NET
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
View: - It is a presentation layer i.e. it shows the
data to the users.
5. BASIC CONVENTIONS IN ASP.NET MVC
There is single controller directory which holds your
Each controller’s name ends with “Controller” e.g. :
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.
6. BASIC CONVENTIONS IN ASP.NET MVC
Controller contains all
Models contains all
Content contains all
CSS / Images / other
Script contains default
scripts loaded MVC
ASP.NET WEB FORMS
ASP.NET WeB Form
Does well with
Not fully Testable
Not much HTML
Supported by heaps of
third party Server side
controls and tools.
Works with SoC
Best for TDD
HTML knowledge is
Supported by various
8. ASP.NET MVC – VIEW ENGINE
Types of View Engine
NDjango using the F#
9. WHY VIEW ENGINES
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. Step 1
ASP.NET MVC REQUEST FLOW
Incoming request directed to
11. Step 2
ASP.NET MVC REQUEST FLOW
Controller processes request and forms
a data Model
12. ASP.NET MVC REQUEST FLOW
Model is passed to View
13. ASP.NET MVC REQUEST FLOW
View transforms Model into
appropriate output format
14. ASP.NET MVC REQUEST LIFE CYCLE
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.
16. ANY QUESTIONS???????????