STUDIERENUND DURCHSTARTEN.Author:	Dip.-Inf. (FH) Johannes HoppeDatum:	06.10.2010	Thanks to:	Eng. KhaledMusaied
RIA – Rich Internet ApplicationsAuthor:	Dip.-Inf. (FH) Johannes HoppeDatum:	06.10.2010Thanks to:	Eng. KhaledMusaied
01Whatis ASP.NET MVC?20.10.2010 Folie 3
Whatis ASP.NET MVC?FrameworkASP.NET MVC Framework, built on top of ASP.NET core frameworkimplements the “Model, View and Controller” pattern20.10.2010 Folie 4
Whatis ASP.NET MVC?MVC PowerComplete control on HTML.Smooth Web 2.0 Development .SEO-friendly URLs.Easy Test Driven Development (TDD).StatelessPrevious ASP.NET technology based on “ViewState”Caused a lot of unnecessary traffic and complexity20.10.2010 Folie 5
Whatis ASP.NET MVC?20.10.2010 Folie 6ModelEncapsulates application’s Data and related LogicsHolds the Data ObjectsOther term: “business layer”Should be “fat”  has usually several more layers (later topic)ViewHandles application’s data presentationWhere all the HTML / CSS / JS / … stuff can be foundControllerManages application’s Flow and Navigational logicsShould be “Skinny”  as few as possible code
Whatis ASP.NET MVC?20.10.2010 Folie 7<<<<<     Always Remember!Skinny Controller,Fat Model
Whatis ASP.NET MVC?MVC + RoutingModelViewControllerRouterURL Mapping“Loads” for the right controllerCalls the right method of the controllerOr sends a HTTP 404 error message on no match20.10.2010 Folie 8
02One HTTP Request in Detail20.10.2010 Folie 9
One HTTP Request in Detail20.10.2010 Folie 100a) Browser (eg Firefox) opens a TCP connection to the Webserver (Microsoft IIS) on Port 80, sends the following text (text extremely shortened)GET / HTTP/1.1Host: yoursite.comIIS decides which application to call(simplified. in real a lot of more stuff is done here)1) Request arrives at the MVC Application
One HTTP Request in Detail20.10.2010 Folie 112) Based upon the Routing table configuration,     the URL request is mapped to an Action (method)     inside an appropriate Controller
One HTTP Request in Detail20.10.2010 Folie 123) Controller accesses the Model to process the data with applying business logics
One HTTP Request in Detail20.10.2010 Folie 134) Model accesses database and results are returned back to the controller’s Action
One HTTP Request in Detail20.10.2010 Folie 145) Action populates the view with processed data and the View renders the User Interface (HTML)
One HTTP Request in Detail20.10.2010 Folie 15IIS sends an HTTP Responseback to the waiting browser:HTTP/1.1 200 OKServer: Microsoft-IIS/6.0Content-Type: text/htmlContent-Length: 999<html><body>…</body></html>
One HTTP Request in Detail20.10.2010 Folie 16
03Code Examples20.10.2010 Folie 17
Code Examples – Model20.10.2010 Folie 18         Note: this only a Data Object, whiteout any business logic!
Code Examples – Controller20.10.2010 Folie 19
Code Examples – View (ASP.NET MVC v1)20.10.2010 Folie 20
Code Examples– View output (MVC)20.10.2010 Folie 21
Code Examples– Routes20.10.2010 Folie 22URL:http://yoursite.com/Customers/Details/21
Rich Internet ApplicationsQuestions??20.10.2010 Folie 23
THANK YOUFOR YOUR ATTENTION20.10.2010 Folie 24

Ria 03 - Hello ASP.NET MVC

  • 1.
    STUDIERENUND DURCHSTARTEN.Author: Dip.-Inf. (FH)Johannes HoppeDatum: 06.10.2010 Thanks to: Eng. KhaledMusaied
  • 2.
    RIA – RichInternet ApplicationsAuthor: Dip.-Inf. (FH) Johannes HoppeDatum: 06.10.2010Thanks to: Eng. KhaledMusaied
  • 3.
  • 4.
    Whatis ASP.NET MVC?FrameworkASP.NETMVC Framework, built on top of ASP.NET core frameworkimplements the “Model, View and Controller” pattern20.10.2010 Folie 4
  • 5.
    Whatis ASP.NET MVC?MVCPowerComplete control on HTML.Smooth Web 2.0 Development .SEO-friendly URLs.Easy Test Driven Development (TDD).StatelessPrevious ASP.NET technology based on “ViewState”Caused a lot of unnecessary traffic and complexity20.10.2010 Folie 5
  • 6.
    Whatis ASP.NET MVC?20.10.2010Folie 6ModelEncapsulates application’s Data and related LogicsHolds the Data ObjectsOther term: “business layer”Should be “fat”  has usually several more layers (later topic)ViewHandles application’s data presentationWhere all the HTML / CSS / JS / … stuff can be foundControllerManages application’s Flow and Navigational logicsShould be “Skinny”  as few as possible code
  • 7.
    Whatis ASP.NET MVC?20.10.2010Folie 7<<<<< Always Remember!Skinny Controller,Fat Model
  • 8.
    Whatis ASP.NET MVC?MVC+ RoutingModelViewControllerRouterURL Mapping“Loads” for the right controllerCalls the right method of the controllerOr sends a HTTP 404 error message on no match20.10.2010 Folie 8
  • 9.
    02One HTTP Requestin Detail20.10.2010 Folie 9
  • 10.
    One HTTP Requestin Detail20.10.2010 Folie 100a) Browser (eg Firefox) opens a TCP connection to the Webserver (Microsoft IIS) on Port 80, sends the following text (text extremely shortened)GET / HTTP/1.1Host: yoursite.comIIS decides which application to call(simplified. in real a lot of more stuff is done here)1) Request arrives at the MVC Application
  • 11.
    One HTTP Requestin Detail20.10.2010 Folie 112) Based upon the Routing table configuration, the URL request is mapped to an Action (method) inside an appropriate Controller
  • 12.
    One HTTP Requestin Detail20.10.2010 Folie 123) Controller accesses the Model to process the data with applying business logics
  • 13.
    One HTTP Requestin Detail20.10.2010 Folie 134) Model accesses database and results are returned back to the controller’s Action
  • 14.
    One HTTP Requestin Detail20.10.2010 Folie 145) Action populates the view with processed data and the View renders the User Interface (HTML)
  • 15.
    One HTTP Requestin Detail20.10.2010 Folie 15IIS sends an HTTP Responseback to the waiting browser:HTTP/1.1 200 OKServer: Microsoft-IIS/6.0Content-Type: text/htmlContent-Length: 999<html><body>…</body></html>
  • 16.
    One HTTP Requestin Detail20.10.2010 Folie 16
  • 17.
  • 18.
    Code Examples –Model20.10.2010 Folie 18 Note: this only a Data Object, whiteout any business logic!
  • 19.
    Code Examples –Controller20.10.2010 Folie 19
  • 20.
    Code Examples –View (ASP.NET MVC v1)20.10.2010 Folie 20
  • 21.
    Code Examples– Viewoutput (MVC)20.10.2010 Folie 21
  • 22.
    Code Examples– Routes20.10.2010Folie 22URL:http://yoursite.com/Customers/Details/21
  • 23.
  • 24.
    THANK YOUFOR YOURATTENTION20.10.2010 Folie 24