本文以一個實際的 ASP.NET Web API 服務開發案例為中心,探討從規劃到上線過程中應注意的要點,包括開發規範、測試導入及專案架構等。文中強調了使用單元測試和保持程式碼設計的良好實踐,以及選用 不同工具和技術以提升開發效率和質量。最後,分享了開發過程中的挑戰與克服方法,並對於不使用 ORM 的理由進行了詳細說明。
70. http://mvc.tw
A simple Test Client built on top of ASP.NET
Web API Help Page
yaohuang
https://github.com/yaohuang/WebApiTestClient
wuchang
https://github.com/wuchang/WebApiTestClient
Web API Test Client
70
82. http://mvc.tw
如果開發的 API 項目很多,在 Postman 的 API 項目列
表就會有一大堆
一個人開發時,還不會有問題。
多人共同開發就必須要保持 API List 內容的一致,
所以可以由 Team Leader 做 API List 的管理,
然後使用匯出的功能,提供給團隊成員匯入
Postman
82
86. http://mvc.tw
在 Web Api 專案內建立一支 API,
將專案內的所有公開的 API 匯出成 Postman 格式,
可以解決在 Postaman 手動新增執行情境的操作,
以及解決各成員操作的 API 內容不一致的問題
Web Api List 匯入 Postman
86
110. http://mvc.tw
ASP.NET MVC / Web API 另一種資料存取方式
– 使用 Dapper 和 LINQPad
因為這一次的分享,公司採購了 LINQPad 5 Premiun
Enterprise 授權
( 這是一個好工具,在開發、測試時都一定會用到 )
內部訓練-測試分享課程及其他相關分享
110
111. http://mvc.tw
ASP.NET Web API 的單元測試和整合測試
(以好房網買屋 APP Web API 專案為例)
Import to Postman, Help Page, Swagger
使用 SpecFlow, SpecRun, Pickles 產生測試報告
內部訓練-測試分享課程及其他相關分享
111
142. http://mvc.tw
Getting Started with ASP.NET Web API 2 (C#)
Tracing in ASP.NET Web API 2
HTTP Message Handlers in ASP.NET Web API
Attribute Routing in ASP.NET Web API 2
ASP.NET Offical WebSite
142
146. http://mvc.tw
Web API Design Jump Start
http://www.microsoftvirtualacademy.com/training
-courses/web-api-design-jump-start
Web Services 開發實戰: 使用 ASP.NET Web API 2
http://www.microsoftvirtualacademy.com/training
-courses/developing-web-services-using-aspnet-
webapi2
線上學習 – Microsoft Virtual Academy
146
158. http://mvc.tw
Samples from ASP.NET Web API 2: Recipes book.
Example source code that accompanies ASP.NET
Web API 2: Building a REST Service from Start
to Finish
Versioning in WebAPI using Route Constraints
https://github.com/sixeyed/webapi-
routeconstraintversioning
Samples @ GitHub
158
167. http://mvc.tw
[筆記][WebAPI] Message Handler 初體驗-搭配 NLog
記錄所有 WebAPI 的 Request 與 Response | topcat
姍舞之間的極度凝聚 - 點部落
從實例學設計模式 by Jace Ju (slides)
PHP 也有 Day #19 - PHP 返樸歸真系列之從實例學設計
模式 by 大澤木小鐵 (Jace Ju)
補充資料
167
168. http://mvc.tw
KingKong Bruce記事:
ASP.NET Web API 文件產生器(1) - Help Page
ASP.NET Web API 文件產生器(2) - Swagger
匯出ASP.NET Web API公開API方法至PostMan
Collections
[ASP.NET] Web API - 匯入API資訊到Postman | No.18
- 點部落
補充資料
168
183. 謝謝各位
• 本投影片所包含的商標與文字皆屬原著作者所有。
• 本投影片使用的圖片皆從網路搜尋。
• 本著作係採用姓名標示-非商業性-相同方式分享 3.0 台灣授權。閱讀本授權條款,請到
http://creativecommons.org/licenses/by-nc-sa/3.0/tw/,或寫信至Creative Commons, 444 Castro
Street, Suite 900, Mountain View, California, 94041, USA.
h t t p : / / m v c . t w