Ria 03 - Hello ASP.NET MVC

1,822 views
1,682 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,822
On SlideShare
0
From Embeds
0
Number of Embeds
300
Actions
Shares
0
Downloads
51
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ria 03 - Hello ASP.NET MVC

  1. 1. STUDIEREN<br />UND DURCHSTARTEN.<br />Author: Dip.-Inf. (FH) Johannes Hoppe<br />Datum: 06.10.2010 <br />Thanks to: Eng. KhaledMusaied<br />
  2. 2. RIA – Rich Internet Applications<br />Author: Dip.-Inf. (FH) Johannes Hoppe<br />Datum: 06.10.2010<br />Thanks to: Eng. KhaledMusaied<br />
  3. 3. 01<br />Whatis ASP.NET MVC?<br />20.10.2010<br /> Folie 3<br />
  4. 4. Whatis ASP.NET MVC?<br />Framework<br />ASP.NET MVC Framework, built on top of ASP.NET core framework<br />implements the “Model, View and Controller” pattern<br />20.10.2010<br /> Folie 4<br />
  5. 5. Whatis ASP.NET MVC?<br />MVC Power<br />Complete control on HTML.<br />Smooth Web 2.0 Development .<br />SEO-friendly URLs.<br />Easy Test Driven Development (TDD).<br />Stateless<br />Previous ASP.NET technology based on “ViewState”<br />Caused a lot of unnecessary traffic and complexity<br />20.10.2010<br /> Folie 5<br />
  6. 6. Whatis ASP.NET MVC?<br />20.10.2010<br /> Folie 6<br />Model<br />Encapsulates application’s Data and related Logics<br />Holds the Data Objects<br />Other term: “business layer”<br />Should be “fat”  has usually several more layers (later topic)<br />View<br />Handles application’s data presentation<br />Where all the HTML / CSS / JS / … stuff can be found<br />Controller<br />Manages application’s Flow and Navigational logics<br />Should be “Skinny”  as few as possible code<br />
  7. 7. Whatis ASP.NET MVC?<br />20.10.2010<br /> Folie 7<br /><<<<< <br />Always Remember!<br />Skinny Controller,Fat Model<br />
  8. 8. Whatis ASP.NET MVC?<br />MVC + Routing<br />Model<br />View<br />Controller<br />Router<br />URL Mapping<br />“Loads” for the right controller<br />Calls the right method of the controller<br />Or sends a HTTP 404 error message on no match<br />20.10.2010<br /> Folie 8<br />
  9. 9. 02<br />One HTTP Request in Detail<br />20.10.2010<br /> Folie 9<br />
  10. 10. One HTTP Request in Detail<br />20.10.2010<br /> Folie 10<br />0a) Browser (eg Firefox) opens a TCP connection to the Webserver (Microsoft IIS) on Port 80, sends the following text (text extremely shortened)<br />GET / HTTP/1.1<br />Host: yoursite.com<br />IIS decides which application to call(simplified. in real a lot of more stuff is done here)<br />1) Request arrives at the MVC Application<br />
  11. 11. One HTTP Request in Detail<br />20.10.2010<br /> Folie 11<br />2) Based upon the Routing table configuration, the URL request is mapped to an Action (method) inside an appropriate Controller<br />
  12. 12. One HTTP Request in Detail<br />20.10.2010<br /> Folie 12<br />3) Controller accesses the Model to process the data with applying business logics<br />
  13. 13. One HTTP Request in Detail<br />20.10.2010<br /> Folie 13<br />4) Model accesses database and results are returned back to the controller’s Action<br />
  14. 14. One HTTP Request in Detail<br />20.10.2010<br /> Folie 14<br />5) Action populates the view with processed data and the View renders the User Interface (HTML)<br />
  15. 15. One HTTP Request in Detail<br />20.10.2010<br /> Folie 15<br />IIS sends an HTTP Responseback to the waiting browser:<br />HTTP/1.1 200 OK<br />Server: Microsoft-IIS/6.0<br />Content-Type: text/html<br />Content-Length: 999<br /><html><body>…</body></html><br />
  16. 16. One HTTP Request in Detail<br />20.10.2010<br /> Folie 16<br />
  17. 17. 03<br />Code Examples<br />20.10.2010<br /> Folie 17<br />
  18. 18. Code Examples – Model<br />20.10.2010<br /> Folie 18<br /> Note: this only a Data Object, whiteout any business logic!<br />
  19. 19. Code Examples – Controller<br />20.10.2010<br /> Folie 19<br />
  20. 20. Code Examples – View (ASP.NET MVC v1)<br />20.10.2010<br /> Folie 20<br />
  21. 21. Code Examples– View output (MVC)<br />20.10.2010<br /> Folie 21<br />
  22. 22. Code Examples– Routes<br />20.10.2010<br /> Folie 22<br />URL:<br />http://yoursite.com/Customers/Details/21<br />
  23. 23. Rich Internet Applications<br />Questions?<br />?<br />20.10.2010<br /> Folie 23<br />
  24. 24. THANK YOU<br />FOR YOUR ATTENTION<br />20.10.2010<br /> Folie 24<br />

×