ria 03 - hello asp.net mvc
DESCRIPTION
TRANSCRIPT
STAATLICHANERKANNTEFACHHOCHSCHULE
Author: Dip.-Inf. (FH) Johannes HoppeDatum: 06.10.2010
Thanks to: Eng. Khaled Musaied
STUDIERENUND DURCHSTARTEN.
STAATLICHANERKANNTEFACHHOCHSCHULE
RIA – Rich Internet Applications
Author: Dip.-Inf. (FH) Johannes HoppeDatum: 06.10.2010
Thanks to: Eng. Khaled Musaied
What is ASP.NET MVC?
0110.04.2023
Folie 3
What is ASP.NET MVC?
Framework
› ASP.NET MVC Framework, built on top of ASP.NET core framework› implements the “Model, View and Controller” pattern
10.04.2023
Folie 4
What is ASP.NET MVC?
MVC Power
› Complete control on HTML.› Smooth Web 2.0 Development .› SEO-friendly URLs.› Easy Test Driven Development (TDD).› Stateless
› Previous ASP.NET technology based on “ViewState”› Caused a lot of unnecessary traffic and complexity
10.04.2023
Folie 5
What is ASP.NET MVC?
10.04.2023
Folie 6
› Model› Encapsulates application’s Data and related Logics› Holds the Data Objects› Other term: “business layer”› Should be “fat” has usually several more layers (later topic)
› View› Handles application’s data presentation› Where all the HTML / CSS / JS / … stuff can be found
› Controller› Manages application’s Flow and Navigational logics› Should be “Skinny” as few as possible code
What is ASP.NET MVC?
10.04.2023
Folie 7
<<<<<
Always Remember!
Skinny Controller,
Fat Model
What is ASP.NET MVC?
MVC + Routing
› Model› View› Controller› Router
› URL Mapping› “Loads” for the right controller› Calls the right method of the controller› Or sends a HTTP 404 error message on no match
10.04.2023
Folie 8
One HTTP Request in Detail
0210.04.2023
Folie 9
One HTTP Request in Detail
10.04.2023
Folie 10
› 0a) 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.com
› IIS 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 Detail
10.04.2023
Folie 11
› 2) Based upon the Routing table configuration, the URL request is mapped to an Action (method) inside an appropriate Controller
One HTTP Request in Detail
10.04.2023
Folie 12
› 3) Controller accesses the Model to process the data with applying business logics
One HTTP Request in Detail
10.04.2023
Folie 13
› 4) Model accesses database and results are returned back to the controller’s Action
One HTTP Request in Detail
10.04.2023
Folie 14
› 5) Action populates the view with processed data and the View renders the User Interface (HTML)
One HTTP Request in Detail
10.04.2023
Folie 15
› IIS 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 Detail
10.04.2023
Folie 16
Code Examples
0310.04.2023
Folie 17
Code Examples – Model
10.04.2023
Folie 18
Note: this only a Data Object, whiteout any business logic!
Code Examples – Controller
10.04.2023
Folie 19
Code Examples – View (ASP.NET MVC v1)
10.04.2023
Folie 20
Code Examples – View output (MVC)
10.04.2023
Folie 21
Code Examples – Routes
10.04.2023
Folie 22
URL:http://yoursite.com/Customers/Details/21
Rich Internet Applications
Questions?
?
10.04.2023
Folie 23
THANK YOUFOR YOUR ATTENTION
10.04.2023
Folie 24