SlideShare une entreprise Scribd logo
1  sur  112
Introduction to
ASP.NET MVC




  Learn More @ http://www.learnnowonline.com
     Copyright © by Application Developers Training Company
Objectives




         Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Objectives
• Understand the basics of the Model-View-
  Controller pattern




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Objectives
• Understand the basics of the Model-View-
  Controller pattern
• Explore the differences between ASP.NET Web
  forms and MVC applications




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Objectives
• Understand the basics of the Model-View-
  Controller pattern
• Explore the differences between ASP.NET Web
  forms and MVC applications
• Build a sample MVC application and explore its
  structure




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Agenda




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
Agenda
• The Model-View-Controller Pattern




           Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Agenda
• The Model-View-Controller Pattern
• Differences Between MVC and Web Forms
  Applications




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Agenda
• The Model-View-Controller Pattern
• Differences Between MVC and Web Forms
  Applications
• Building a Simple MVC Application with Visual
  Studio




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
The Model-View-Controller Pattern




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
The Model-View-Controller Pattern
• ASP.NET MVC is a revolutionary way to develop
  Web applications




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
The Model-View-Controller Pattern
• ASP.NET MVC is a revolutionary way to develop
  Web applications
   Built on Model-View-Controller pattern




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
The Model-View-Controller Pattern
• ASP.NET MVC is a revolutionary way to develop
  Web applications
   Built on Model-View-Controller pattern
   Separation of concerns




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
The Model-View-Controller Pattern
• ASP.NET MVC is a revolutionary way to develop
  Web applications
   Built on Model-View-Controller pattern
   Separation of concerns
   Invented in 1978 by Trygve Reenskaug




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
The Model-View-Controller Pattern
• ASP.NET MVC is a revolutionary way to develop
  Web applications
     Built on Model-View-Controller pattern
     Separation of concerns
     Invented in 1978 by Trygve Reenskaug
     Very popular in Web development frameworks




               Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
The MVC Architecture




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller




                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application




                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application
  1. Interacts with Web page




                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application
  1. Interacts with Web page
  2. Controller handles request




                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application
  1. Interacts with Web page
  2. Controller handles request
  3. Notifies model of changes



                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application
  1.   Interacts with Web page
  2.   Controller handles request
  3.   Notifies model of changes
  4.   Controller selects a view


                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
The MVC Architecture
• Three primary components
   Model
   View
   Controller
• User interaction with application
  1.   Interacts with Web page
  2.   Controller handles request
  3.   Notifies model of changes
  4.   Controller selects a view
  5.   Await new user interaction

                 Learn More @ http://www.learnnowonline.com
                    Copyright © by Application Developers Training Company
Anatomy of a Request




        Learn More @ http://www.learnnowonline.com
           Copyright © by Application Developers Training Company
Anatomy of a Request

   HTTP Request
                                                Controller                 Model
  HTML Response         View


                                                                            Optional
                                                                           Persistent
                                                                            Storage




             Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
ASP.NET MVC




        Learn More @ http://www.learnnowonline.com
           Copyright © by Application Developers Training Company
ASP.NET MVC
• Microsoft’s newest Web development framework




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
ASP.NET MVC
• Microsoft’s newest Web development framework
   Easy to implement design principles and patterns




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
ASP.NET MVC
• Microsoft’s newest Web development framework
   Easy to implement design principles and patterns
   Integral part of ASP.NET




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
ASP.NET MVC
• Microsoft’s newest Web development framework
   Easy to implement design principles and patterns
   Integral part of ASP.NET
• First implementation by Scott Guthrie




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
ASP.NET MVC
• Microsoft’s newest Web development framework
   Easy to implement design principles and patterns
   Integral part of ASP.NET
• First implementation by Scott Guthrie
• Built using core ASP.NET features




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Differences Between MVC and Web




        Learn More @ http://www.learnnowonline.com
           Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
   Rich infrastructure for Web version of desktop applications




                Learn More @ http://www.learnnowonline.com
                   Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
   Rich infrastructure for Web version of desktop applications
   Abstracts limitations of HTTP




                Learn More @ http://www.learnnowonline.com
                   Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
   Rich infrastructure for Web version of desktop applications
   Abstracts limitations of HTTP
   Uses ViewState as a major feature




                Learn More @ http://www.learnnowonline.com
                   Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface




                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface
• Problems with Web forms




                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface
• Problems with Web forms
   Little control over HTML




                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface
• Problems with Web forms
   Little control over HTML
   ViewState can bloat




                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface
• Problems with Web forms
   Little control over HTML
   ViewState can bloat
   Limited support for testing



                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
Differences Between MVC and Web
• ASP.NET Web forms was revolutionary in its day
     Rich infrastructure for Web version of desktop applications
     Abstracts limitations of HTTP
     Uses ViewState as a major feature
     Drag and drop development interface
• Problems with Web forms
     Little control over HTML
     ViewState can bloat
     Limited support for testing
     Complicated page lifecycle


                  Learn More @ http://www.learnnowonline.com
                     Copyright © by Application Developers Training Company
The Tenets of MVC




        Learn More @ http://www.learnnowonline.com
           Copyright © by Application Developers Training Company
The Tenets of MVC
• Separation of concerns




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
The Tenets of MVC
• Separation of concerns
• Convention over configuration




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
The Tenets of MVC
• Separation of concerns
• Convention over configuration
• Keep it DRY: Don’t Repeat Yourself




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
The Tenets of MVC
•   Separation of concerns
•   Convention over configuration
•   Keep it DRY: Don’t Repeat Yourself
•   Be helpful, but get out of my way




               Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
Web Forms vs. MVC                         Extensibility




        Learn More @ http://www.learnnowonline.com
           Copyright © by Application Developers Training Company
Web Forms vs. MVC                              Extensibility


• ASP.NET has a provider model




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC                             Extensibility


• ASP.NET has a provider model
• MVC has a more powerful pluggable model




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Web Forms vs. MVC                             Extensibility


• ASP.NET has a provider model
• MVC has a more powerful pluggable model
• Options




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Web Forms vs. MVC                               Extensibility


• ASP.NET has a provider model
• MVC has a more powerful pluggable model
• Options
   Use the default component




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC                               Extensibility


• ASP.NET has a provider model
• MVC has a more powerful pluggable model
• Options
   Use the default component
   Extend the default component




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC                               Extensibility


• ASP.NET has a provider model
• MVC has a more powerful pluggable model
• Options
   Use the default component
   Extend the default component
   Replace the default component




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns
• Web forms almost forces combination of view
  and controller




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns
• Web forms almost forces combination of view
  and controller
• False sense of separation from code behind files




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns
• Web forms almost forces combination of view
  and controller
• False sense of separation from code behind files
   Reality: close coupling




               Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns
• Web forms almost forces combination of view
  and controller
• False sense of separation from code behind files
   Reality: close coupling
• MVC’s separation of concerns encourages good
  coding practices




               Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
Web Forms vs. MVC
Blending of Concerns
• Web forms almost forces combination of view
  and controller
• False sense of separation from code behind files
   Reality: close coupling
• MVC’s separation of concerns encourages good
  coding practices
   Ideally suited to Web application development




               Learn More @ http://www.learnnowonline.com
                  Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference
• File request:
  http://www.example.com/index.aspx?ID=5




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference
• File request:
  http://www.example.com/index.aspx?ID=5
• Method request:
  http://www.example.com/Home/Details/5




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference
• File request:
  http://www.example.com/index.aspx?ID=5
• Method request:
  http://www.example.com/Home/Details/5
   Maps to Details action method




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference
• File request:
  http://www.example.com/index.aspx?ID=5
• Method request:
  http://www.example.com/Home/Details/5
   Maps to Details action method
   Of Home controller




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
MVC Serves Methods, Not Files
• Huge difference
• File request:
  http://www.example.com/index.aspx?ID=5
• Method request:
  http://www.example.com/Home/Details/5
   Maps to Details action method
   Of Home controller
   Item ID of 5



              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Testability




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Testability
• Testing helps make applications more robust in
  the face of changes




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Testability
• Testing helps make applications more robust in
  the face of changes
• Unit test automates verification of a method




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Testability
• Testing helps make applications more robust in
  the face of changes
• Unit test automates verification of a method
• Can use the test-driven development
  methodology




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Testability
• Testing helps make applications more robust in
  the face of changes
• Unit test automates verification of a method
• Can use the test-driven development
  methodology
• Web forms make automated testing almost
  impossible




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Control over HTML




            Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Web Forms vs. MVC
Control over HTML
• Web forms server controls provide rich
  functionality




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Web Forms vs. MVC
Control over HTML
• Web forms server controls provide rich
  functionality
   Produce unreadable, monolithic blocks of HTML




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Control over HTML
• Web forms server controls provide rich
  functionality
   Produce unreadable, monolithic blocks of HTML
• MVC gives you complete control over HTML




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Open Source




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Open Source
• MVC source code is available




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Web Forms vs. MVC
Open Source
• MVC source code is available
• Liberal open source license: Microsoft Public
  License




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Building a Simple MVC Application




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
Building a Simple MVC Application
• Building MVC applications can be efficient,
  because:




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Building a Simple MVC Application
• Building MVC applications can be efficient,
  because:
   Web forms often require fragmented code




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Building a Simple MVC Application
• Building MVC applications can be efficient,
  because:
   Web forms often require fragmented code
   MVC’s convention over configuration




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Building a Simple MVC Application
• Building MVC applications can be efficient,
  because:
   Web forms often require fragmented code
   MVC’s convention over configuration
   MVC tools in Visual Studio 2008 and 2010




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Building a Simple MVC Application
• Building MVC applications can be efficient,
  because:
   Web forms often require fragmented code
   MVC’s convention over configuration
   MVC tools in Visual Studio 2008 and 2010
• Best of all worlds with MVC




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
MVC Project Templates




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application




                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application
   Intranet Application template




                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application
   Intranet Application template
     o   Same as Internet template, but uses Windows authentication




                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application
   Intranet Application template
     o   Same as Internet template, but uses Windows authentication
   Empty template




                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application
   Intranet Application template
     o   Same as Internet template, but uses Windows authentication
   Empty template
     o   Sets up project structure but no controllers or models




                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
MVC Project Templates
• Includes one Visual Studio Project template
   Available for VB and C#
• Includes templates for three project types
   Internet Application template
     o   Basic but fully functional MVC application
   Intranet Application template
     o   Same as Internet template, but uses Windows authentication
   Empty template
     o   Sets up project structure but no controllers or models
• Use whichever template you like

                  Learn More @ http://www.learnnowonline.com
                      Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3




         Learn More @ http://www.learnnowonline.com
            Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3
• Process is manual




             Learn More @ http://www.learnnowonline.com
                Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3
• Process is manual
   Change a GUID, copy files, change web.config, etc.




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3
• Process is manual
   Change a GUID, copy files, change web.config, etc.
   Better to just create a new project and move stuff?




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3
• Process is manual
   Change a GUID, copy files, change web.config, etc.
   Better to just create a new project and move stuff?
   Release notes cover the basic steps




              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Upgrading from MVC 2 to 3
• Can install MVC 3 side-by-side with MVC 1 and 2
• When ready, upgrade to MVC 3
• Process is manual
   Change a GUID, copy files, change web.config, etc.
   Better to just create a new project and move stuff?
   Release notes cover the basic steps
• Microsoft’s Eilon Lipton has an unsupported
  migration tool


              Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Learn More!




       Learn More @ http://www.learnnowonline.com
          Copyright © by Application Developers Training Company
Learn More!
• This is an excerpt from a larger course. Visit
  www.learnnowonline.com for the full details!




           Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Learn More!
• This is an excerpt from a larger course. Visit
  www.learnnowonline.com for the full details!




           Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Learn More!
• This is an excerpt from a larger course. Visit
  www.learnnowonline.com for the full details!


• Learn more about MVC on SlideShare:




           Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Learn More!
• This is an excerpt from a larger course. Visit
  www.learnnowonline.com for the full details!


• Learn more about MVC on SlideShare:
  • Working with Controllers and Actions in MVC




           Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company

Contenu connexe

Tendances

ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles
 

Tendances (20)

ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
MVC Training Part 1
MVC Training Part 1MVC Training Part 1
MVC Training Part 1
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 
Mvc4
Mvc4Mvc4
Mvc4
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
 
What's new in Angular 2?
What's new in Angular 2?What's new in Angular 2?
What's new in Angular 2?
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP Developers
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
Future ASP.NET features for UID / HTML developers
Future ASP.NET features for UID / HTML developersFuture ASP.NET features for UID / HTML developers
Future ASP.NET features for UID / HTML developers
 
Angular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison GuideAngular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison Guide
 
AngularJS
AngularJSAngularJS
AngularJS
 

En vedette

6th math -c2--l12--sept17
6th math -c2--l12--sept176th math -c2--l12--sept17
6th math -c2--l12--sept17
jdurst65
 
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند a as architecture
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند   a as architectureزانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند   a as architecture
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند a as architecture
Reda Mohmed Ali
 
痛風者救星
痛風者救星痛風者救星
痛風者救星
lys167
 

En vedette (20)

Quoi de neuf dans ASP.NET MVC 4
Quoi de neuf dans ASP.NET MVC 4Quoi de neuf dans ASP.NET MVC 4
Quoi de neuf dans ASP.NET MVC 4
 
ASP.NET MVC 5 et Web API 2
ASP.NET MVC 5 et Web API 2ASP.NET MVC 5 et Web API 2
ASP.NET MVC 5 et Web API 2
 
ASP.NET MVC 6
ASP.NET MVC 6ASP.NET MVC 6
ASP.NET MVC 6
 
Android Aalto -- Mobile UX
Android Aalto -- Mobile UXAndroid Aalto -- Mobile UX
Android Aalto -- Mobile UX
 
6th math -c2--l12--sept17
6th math -c2--l12--sept176th math -c2--l12--sept17
6th math -c2--l12--sept17
 
Mixed tape
Mixed tapeMixed tape
Mixed tape
 
Modulo 3
Modulo 3Modulo 3
Modulo 3
 
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند a as architecture
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند   a as architectureزانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند   a as architecture
زانج تسي تونج وModern المتحف الصناعي ودانييل ليبسكيند a as architecture
 
Custorio power point
Custorio power pointCustorio power point
Custorio power point
 
Archivision Vendor Slam 2010
Archivision Vendor Slam 2010Archivision Vendor Slam 2010
Archivision Vendor Slam 2010
 
The kSORT assay to detect renal transplant patients at risk for acute rejecti...
The kSORT assay to detect renal transplant patients at risk for acute rejecti...The kSORT assay to detect renal transplant patients at risk for acute rejecti...
The kSORT assay to detect renal transplant patients at risk for acute rejecti...
 
List of occupations_01.06.2011
List of occupations_01.06.2011List of occupations_01.06.2011
List of occupations_01.06.2011
 
MARZO 18 AL 23 DE 2013
MARZO 18 AL 23 DE 2013MARZO 18 AL 23 DE 2013
MARZO 18 AL 23 DE 2013
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Коробка инструментов как и из чего делать лонгриды и презентации
Коробка инструментов  как и из чего делать лонгриды и презентацииКоробка инструментов  как и из чего делать лонгриды и презентации
Коробка инструментов как и из чего делать лонгриды и презентации
 
Distance selling 2013 fullfilment presentation
Distance selling 2013 fullfilment presentationDistance selling 2013 fullfilment presentation
Distance selling 2013 fullfilment presentation
 
Dr. Krishnan's Therapeutic touch
Dr. Krishnan's Therapeutic touchDr. Krishnan's Therapeutic touch
Dr. Krishnan's Therapeutic touch
 
SECURITY ALGORITHMS FOR WIMAX
SECURITY ALGORITHMS FOR WIMAXSECURITY ALGORITHMS FOR WIMAX
SECURITY ALGORITHMS FOR WIMAX
 
Fear Response Related Behavior
Fear Response Related BehaviorFear Response Related Behavior
Fear Response Related Behavior
 
痛風者救星
痛風者救星痛風者救星
痛風者救星
 

Similaire à Introduction to ASP.NET MVC

10264 developing web applications with microsoft visual studio 2010
10264 developing web applications with microsoft visual studio 201010264 developing web applications with microsoft visual studio 2010
10264 developing web applications with microsoft visual studio 2010
bestip
 

Similaire à Introduction to ASP.NET MVC (20)

Working with Controllers and Actions in MVC
Working with Controllers and Actions in MVCWorking with Controllers and Actions in MVC
Working with Controllers and Actions in MVC
 
What's new in Silverlight 5
What's new in Silverlight 5What's new in Silverlight 5
What's new in Silverlight 5
 
Building Windows 8 Metro Style Applications Using JavaScript and HTML5
Building Windows 8 Metro Style Applications Using JavaScript and HTML5Building Windows 8 Metro Style Applications Using JavaScript and HTML5
Building Windows 8 Metro Style Applications Using JavaScript and HTML5
 
KnockOutJS with ASP.NET MVC
KnockOutJS with ASP.NET MVCKnockOutJS with ASP.NET MVC
KnockOutJS with ASP.NET MVC
 
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORKSpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
SpringPeople Building Web Sites with ASP.NET MVC FRAMEWORK
 
Web API HTTP Pipeline
Web API HTTP PipelineWeb API HTTP Pipeline
Web API HTTP Pipeline
 
Web API Basics
Web API BasicsWeb API Basics
Web API Basics
 
The Entity Data Model
The Entity Data ModelThe Entity Data Model
The Entity Data Model
 
Managing site collections
Managing site collectionsManaging site collections
Managing site collections
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
 
Difference between MVC 3, 4, 5 and 6
Difference between MVC 3, 4, 5 and 6Difference between MVC 3, 4, 5 and 6
Difference between MVC 3, 4, 5 and 6
 
Asp.net
Asp.netAsp.net
Asp.net
 
Ektron Synergy 2014 - A Case Study in Using MVC with Ektron
Ektron Synergy 2014 - A Case Study in Using MVC with EktronEktron Synergy 2014 - A Case Study in Using MVC with Ektron
Ektron Synergy 2014 - A Case Study in Using MVC with Ektron
 
Mvc3 part1
Mvc3   part1Mvc3   part1
Mvc3 part1
 
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
MVC Architecture: A Detailed Insight to the Modern Web Applications Developme...
 
Getting Started with .NET
Getting Started with .NETGetting Started with .NET
Getting Started with .NET
 
No brainer
No brainerNo brainer
No brainer
 
Mvc part 1
Mvc part 1Mvc part 1
Mvc part 1
 
10264 developing web applications with microsoft visual studio 2010
10264 developing web applications with microsoft visual studio 201010264 developing web applications with microsoft visual studio 2010
10264 developing web applications with microsoft visual studio 2010
 

Plus de LearnNowOnline

Plus de LearnNowOnline (20)

Windows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesWindows 8: Shapes and Geometries
Windows 8: Shapes and Geometries
 
SQL: Permissions and Data Protection
SQL: Permissions and Data ProtectionSQL: Permissions and Data Protection
SQL: Permissions and Data Protection
 
New in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDENew in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDE
 
Attributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programmingAttributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programming
 
Asynchronous Programming
Asynchronous ProgrammingAsynchronous Programming
Asynchronous Programming
 
WPF: Working with Data
WPF: Working with DataWPF: Working with Data
WPF: Working with Data
 
WPF Binding
WPF BindingWPF Binding
WPF Binding
 
A tour of SQL Server
A tour of SQL ServerA tour of SQL Server
A tour of SQL Server
 
Introducing LINQ
Introducing LINQIntroducing LINQ
Introducing LINQ
 
Generics
GenericsGenerics
Generics
 
Object oriented techniques
Object oriented techniquesObject oriented techniques
Object oriented techniques
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
SharePoint Document Management
SharePoint Document ManagementSharePoint Document Management
SharePoint Document Management
 
SharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPathSharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPath
 
SQL Server: Security
SQL Server: SecuritySQL Server: Security
SQL Server: Security
 
Sql 2012 development and programming
Sql 2012  development and programmingSql 2012  development and programming
Sql 2012 development and programming
 
Expression Blend Motion & Interaction Design
Expression Blend Motion & Interaction DesignExpression Blend Motion & Interaction Design
Expression Blend Motion & Interaction Design
 
Introducing the Entity Framework
Introducing the Entity FrameworkIntroducing the Entity Framework
Introducing the Entity Framework
 
Creating a User Interface
Creating a User InterfaceCreating a User Interface
Creating a User Interface
 
.Net branching and flow control
.Net branching and flow control.Net branching and flow control
.Net branching and flow control
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Introduction to ASP.NET MVC

  • 1. Introduction to ASP.NET MVC Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 2. Objectives Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 3. Objectives • Understand the basics of the Model-View- Controller pattern Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 4. Objectives • Understand the basics of the Model-View- Controller pattern • Explore the differences between ASP.NET Web forms and MVC applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 5. Objectives • Understand the basics of the Model-View- Controller pattern • Explore the differences between ASP.NET Web forms and MVC applications • Build a sample MVC application and explore its structure Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 6. Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 7. Agenda • The Model-View-Controller Pattern Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 8. Agenda • The Model-View-Controller Pattern • Differences Between MVC and Web Forms Applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 9. Agenda • The Model-View-Controller Pattern • Differences Between MVC and Web Forms Applications • Building a Simple MVC Application with Visual Studio Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 10. The Model-View-Controller Pattern Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 11. The Model-View-Controller Pattern • ASP.NET MVC is a revolutionary way to develop Web applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 12. The Model-View-Controller Pattern • ASP.NET MVC is a revolutionary way to develop Web applications  Built on Model-View-Controller pattern Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 13. The Model-View-Controller Pattern • ASP.NET MVC is a revolutionary way to develop Web applications  Built on Model-View-Controller pattern  Separation of concerns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 14. The Model-View-Controller Pattern • ASP.NET MVC is a revolutionary way to develop Web applications  Built on Model-View-Controller pattern  Separation of concerns  Invented in 1978 by Trygve Reenskaug Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 15. The Model-View-Controller Pattern • ASP.NET MVC is a revolutionary way to develop Web applications  Built on Model-View-Controller pattern  Separation of concerns  Invented in 1978 by Trygve Reenskaug  Very popular in Web development frameworks Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 16. The MVC Architecture Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 17. The MVC Architecture • Three primary components Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 18. The MVC Architecture • Three primary components  Model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 19. The MVC Architecture • Three primary components  Model  View Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 20. The MVC Architecture • Three primary components  Model  View  Controller Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 21. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 22. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application 1. Interacts with Web page Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 23. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application 1. Interacts with Web page 2. Controller handles request Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 24. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application 1. Interacts with Web page 2. Controller handles request 3. Notifies model of changes Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 25. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application 1. Interacts with Web page 2. Controller handles request 3. Notifies model of changes 4. Controller selects a view Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 26. The MVC Architecture • Three primary components  Model  View  Controller • User interaction with application 1. Interacts with Web page 2. Controller handles request 3. Notifies model of changes 4. Controller selects a view 5. Await new user interaction Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 27. Anatomy of a Request Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 28. Anatomy of a Request HTTP Request Controller Model HTML Response View Optional Persistent Storage Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 29. ASP.NET MVC Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 30. ASP.NET MVC • Microsoft’s newest Web development framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 31. ASP.NET MVC • Microsoft’s newest Web development framework  Easy to implement design principles and patterns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 32. ASP.NET MVC • Microsoft’s newest Web development framework  Easy to implement design principles and patterns  Integral part of ASP.NET Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 33. ASP.NET MVC • Microsoft’s newest Web development framework  Easy to implement design principles and patterns  Integral part of ASP.NET • First implementation by Scott Guthrie Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 34. ASP.NET MVC • Microsoft’s newest Web development framework  Easy to implement design principles and patterns  Integral part of ASP.NET • First implementation by Scott Guthrie • Built using core ASP.NET features Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 35. Differences Between MVC and Web Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 36. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 37. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 38. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 39. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 40. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 41. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface • Problems with Web forms Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 42. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface • Problems with Web forms  Little control over HTML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 43. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface • Problems with Web forms  Little control over HTML  ViewState can bloat Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 44. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface • Problems with Web forms  Little control over HTML  ViewState can bloat  Limited support for testing Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 45. Differences Between MVC and Web • ASP.NET Web forms was revolutionary in its day  Rich infrastructure for Web version of desktop applications  Abstracts limitations of HTTP  Uses ViewState as a major feature  Drag and drop development interface • Problems with Web forms  Little control over HTML  ViewState can bloat  Limited support for testing  Complicated page lifecycle Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 46. The Tenets of MVC Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 47. The Tenets of MVC • Separation of concerns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 48. The Tenets of MVC • Separation of concerns • Convention over configuration Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 49. The Tenets of MVC • Separation of concerns • Convention over configuration • Keep it DRY: Don’t Repeat Yourself Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 50. The Tenets of MVC • Separation of concerns • Convention over configuration • Keep it DRY: Don’t Repeat Yourself • Be helpful, but get out of my way Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 51. Web Forms vs. MVC Extensibility Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 52. Web Forms vs. MVC Extensibility • ASP.NET has a provider model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 53. Web Forms vs. MVC Extensibility • ASP.NET has a provider model • MVC has a more powerful pluggable model Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 54. Web Forms vs. MVC Extensibility • ASP.NET has a provider model • MVC has a more powerful pluggable model • Options Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 55. Web Forms vs. MVC Extensibility • ASP.NET has a provider model • MVC has a more powerful pluggable model • Options  Use the default component Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 56. Web Forms vs. MVC Extensibility • ASP.NET has a provider model • MVC has a more powerful pluggable model • Options  Use the default component  Extend the default component Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 57. Web Forms vs. MVC Extensibility • ASP.NET has a provider model • MVC has a more powerful pluggable model • Options  Use the default component  Extend the default component  Replace the default component Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 58. Web Forms vs. MVC Blending of Concerns Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 59. Web Forms vs. MVC Blending of Concerns • Web forms almost forces combination of view and controller Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 60. Web Forms vs. MVC Blending of Concerns • Web forms almost forces combination of view and controller • False sense of separation from code behind files Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 61. Web Forms vs. MVC Blending of Concerns • Web forms almost forces combination of view and controller • False sense of separation from code behind files  Reality: close coupling Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 62. Web Forms vs. MVC Blending of Concerns • Web forms almost forces combination of view and controller • False sense of separation from code behind files  Reality: close coupling • MVC’s separation of concerns encourages good coding practices Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 63. Web Forms vs. MVC Blending of Concerns • Web forms almost forces combination of view and controller • False sense of separation from code behind files  Reality: close coupling • MVC’s separation of concerns encourages good coding practices  Ideally suited to Web application development Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 64. Web Forms vs. MVC MVC Serves Methods, Not Files Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 65. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 66. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference • File request: http://www.example.com/index.aspx?ID=5 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 67. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference • File request: http://www.example.com/index.aspx?ID=5 • Method request: http://www.example.com/Home/Details/5 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 68. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference • File request: http://www.example.com/index.aspx?ID=5 • Method request: http://www.example.com/Home/Details/5  Maps to Details action method Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 69. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference • File request: http://www.example.com/index.aspx?ID=5 • Method request: http://www.example.com/Home/Details/5  Maps to Details action method  Of Home controller Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 70. Web Forms vs. MVC MVC Serves Methods, Not Files • Huge difference • File request: http://www.example.com/index.aspx?ID=5 • Method request: http://www.example.com/Home/Details/5  Maps to Details action method  Of Home controller  Item ID of 5 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 71. Web Forms vs. MVC Testability Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 72. Web Forms vs. MVC Testability • Testing helps make applications more robust in the face of changes Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 73. Web Forms vs. MVC Testability • Testing helps make applications more robust in the face of changes • Unit test automates verification of a method Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 74. Web Forms vs. MVC Testability • Testing helps make applications more robust in the face of changes • Unit test automates verification of a method • Can use the test-driven development methodology Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 75. Web Forms vs. MVC Testability • Testing helps make applications more robust in the face of changes • Unit test automates verification of a method • Can use the test-driven development methodology • Web forms make automated testing almost impossible Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 76. Web Forms vs. MVC Control over HTML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 77. Web Forms vs. MVC Control over HTML • Web forms server controls provide rich functionality Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 78. Web Forms vs. MVC Control over HTML • Web forms server controls provide rich functionality  Produce unreadable, monolithic blocks of HTML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 79. Web Forms vs. MVC Control over HTML • Web forms server controls provide rich functionality  Produce unreadable, monolithic blocks of HTML • MVC gives you complete control over HTML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 80. Web Forms vs. MVC Open Source Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 81. Web Forms vs. MVC Open Source • MVC source code is available Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 82. Web Forms vs. MVC Open Source • MVC source code is available • Liberal open source license: Microsoft Public License Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 83. Building a Simple MVC Application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 84. Building a Simple MVC Application • Building MVC applications can be efficient, because: Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 85. Building a Simple MVC Application • Building MVC applications can be efficient, because:  Web forms often require fragmented code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 86. Building a Simple MVC Application • Building MVC applications can be efficient, because:  Web forms often require fragmented code  MVC’s convention over configuration Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 87. Building a Simple MVC Application • Building MVC applications can be efficient, because:  Web forms often require fragmented code  MVC’s convention over configuration  MVC tools in Visual Studio 2008 and 2010 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 88. Building a Simple MVC Application • Building MVC applications can be efficient, because:  Web forms often require fragmented code  MVC’s convention over configuration  MVC tools in Visual Studio 2008 and 2010 • Best of all worlds with MVC Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 89. MVC Project Templates Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 90. MVC Project Templates • Includes one Visual Studio Project template Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 91. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 92. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 93. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 94. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 95. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application  Intranet Application template Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 96. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application  Intranet Application template o Same as Internet template, but uses Windows authentication Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 97. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application  Intranet Application template o Same as Internet template, but uses Windows authentication  Empty template Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 98. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application  Intranet Application template o Same as Internet template, but uses Windows authentication  Empty template o Sets up project structure but no controllers or models Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 99. MVC Project Templates • Includes one Visual Studio Project template  Available for VB and C# • Includes templates for three project types  Internet Application template o Basic but fully functional MVC application  Intranet Application template o Same as Internet template, but uses Windows authentication  Empty template o Sets up project structure but no controllers or models • Use whichever template you like Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 100. Upgrading from MVC 2 to 3 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 101. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 102. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 103. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 • Process is manual Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 104. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 • Process is manual  Change a GUID, copy files, change web.config, etc. Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 105. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 • Process is manual  Change a GUID, copy files, change web.config, etc.  Better to just create a new project and move stuff? Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 106. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 • Process is manual  Change a GUID, copy files, change web.config, etc.  Better to just create a new project and move stuff?  Release notes cover the basic steps Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 107. Upgrading from MVC 2 to 3 • Can install MVC 3 side-by-side with MVC 1 and 2 • When ready, upgrade to MVC 3 • Process is manual  Change a GUID, copy files, change web.config, etc.  Better to just create a new project and move stuff?  Release notes cover the basic steps • Microsoft’s Eilon Lipton has an unsupported migration tool Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 108. Learn More! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 109. Learn More! • This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 110. Learn More! • This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 111. Learn More! • This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! • Learn more about MVC on SlideShare: Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 112. Learn More! • This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! • Learn more about MVC on SlideShare: • Working with Controllers and Actions in MVC Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. DEMO: rest of chapter to upgrading section\n
  93. DEMO: rest of chapter to upgrading section\n
  94. DEMO: rest of chapter to upgrading section\n
  95. DEMO: rest of chapter to upgrading section\n
  96. DEMO: rest of chapter to upgrading section\n
  97. DEMO: rest of chapter to upgrading section\n
  98. DEMO: rest of chapter to upgrading section\n
  99. DEMO: rest of chapter to upgrading section\n
  100. DEMO: rest of chapter to upgrading section\n
  101. DEMO: rest of chapter to upgrading section\n
  102. DEMO: rest of section\n
  103. DEMO: rest of section\n
  104. DEMO: rest of section\n
  105. DEMO: rest of section\n
  106. DEMO: rest of section\n
  107. DEMO: rest of section\n
  108. DEMO: rest of section\n
  109. DEMO: rest of section\n
  110. DEMO: rest of section\n
  111. DEMO: rest of section\n
  112. DEMO: rest of section\n