Web Api vs MVC
Click here to load reader
-
Upload
chaowlert-chaisrichalermpol -
Category
Software
-
view
224 -
download
1
description
Transcript of Web Api vs MVC
![Page 1: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/1.jpg)
WebApi vs MVC
![Page 2: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/2.jpg)
About
Chaowlert C.
Production WebApi experience on- Samsung Gift- AIS Privilege- InSing (SingTel Social)
![Page 3: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/3.jpg)
Overview
WebApi- Provide REST service- Backend for Mobile Device
- Backend for JavaScript
MVC- Provide Web Page
![Page 4: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/4.jpg)
MVC vs WebApi
MVC WebApi
Model View
HTML
ModelContent
Negotiation
Result
![Page 5: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/5.jpg)
Content Negotiation
- Return format from request- Get format from header, querystring, extension, and more
- Built-in support for json, xml, bson- You can create your own format ie. csv, atom, protobuf.net
![Page 6: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/6.jpg)
Content Negotiation 2
- Accept various input formats from request
- Built-in support for url encoded, json, xml, bson
![Page 7: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/7.jpg)
Queryable / OData
- Query from result set- $top, $skip, $select, $orderby, $inlinecount, $filter, $expand
- Query operation is done from database
![Page 8: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/8.jpg)
Auto resolve action
- Match action without explicitly define- Your url will comply to REST conventionGET /api/product/{id} for retrievePOST /api/product for insertPUT /api/product/{id} for updateDELETE /api/product/{id} for delete
![Page 9: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/9.jpg)
Exception
- Exception is data not html- Http Status Code will tell you error category
400: wrong parameter401: not login403: no authorize404: not found...
![Page 10: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/10.jpg)
Html Help Page
- Create help pages instantly- Utilize xml comments from your codes
![Page 11: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/11.jpg)
Control over Http Pipeline
- Alter Http Request and Response- Control over content- Push stream content- Byte range content- or your own
![Page 12: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/12.jpg)
More!!!
- CORS support (cross domain request)- Support Batch operation- Not need to host on IIS, WebApi is portable
![Page 13: Web Api vs MVC](https://reader037.fdocuments.in/reader037/viewer/2022100323/5454da30b1af9f40378b4594/html5/thumbnails/13.jpg)
Thank you
This event sponsored by
And we are hiring!