ASP.NET MVC 4 Beta:強化Web API

來源:互聯網
上載者:User

ASP.NET MVC 4 Beta 新功能特性:

(1) ASP.NET Web API

(2) 添加移動項目模板

(3) 對移動 app 特性的功能支援,JQuery Moblie,View Switcher and Browser Overriding

(4) 提升自訂代碼產生器

(5) 增強非同步方法呼叫,非同步產生器提供返回參數支援 Task 執行個體。

(6) 單頁面應用程式的支援

(7) 增強預設範本功能。

(8) 更好的支援 Windows Azure SDK

(9) 改進 Razor View Engine.

(10) 當 WebMatrix.WebData.dll 被放在項目目錄中/bin 中時,將請求 URL 時候預設 froms 身份認證。

在 ASP.NET Web API 中共有以下幾個特性:

Modern HTTP programming model:

最強大的功能之一, 它可以在 HttpWebRequest 中公開強行別的資料

Full support for routes:

它也是 Route 基礎下,因此支援 MVC 所有功能,如 [HttpPost] 等 Attributes 。

Content negotiation:

它的 Client 與 Server 使用共同的 API 與資料格式,預設支援 JSON、XML 等。當然您也可以在這個基礎上開發自己的資料轉送格式。

Model binding and validation:

在模型繫結中使用強行別 HttpWebRequest 的資料,使用上更容易。

Filters: 如同 MVC 準系統一樣,支援動作、驗證的過濾等動作,以及錯誤處理的部分。

Query composition:

它可公開如 IQueryable<T> 可查詢的介面。也支援 OData 協議。

Improved testability of HTTP details:

在這個平台上,HTTP的行細資訊、Context 對象等動作,現在多了HttpRequestMessage 與 HttpResponseMessage 這兩個執行個體對象。就是透過它使您可以在 HttpWebRequest 中傳遞自定的型別。

Improved Inversion of Control (IoC) via DependencyResolver:

如同 MVC 的架構上,你很容易實現 IoC 的設計模式。

Code-based configuration:

設定 Web API 的相關功能只要使用幾行 Code 就可以了,不需要修改任何 Configuration 檔案的內容。

Self-host: 前面有提到過了,Web API 的服務的部分是允許獨立出來進行服務的。稱為 Self-Host。

 

更多資源:請參考http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253813

asp.net mvc web api 教程

:http://www.asp.net/mvc/mvc4

http://weblogs.asp.net/jgalloway/archive/2012/02/16/asp-net-4-beta-released.aspx

Getting Started with ASP.NET Web API

http://www.asp.net/web-api

Introducing ASP.NET MVC 4 Beta with Web APIs

http://blogs.msdn.com/b/carlosfigueira/archive/2012/02/16/introducing-asp-net-mvc-4-beta-with-web-apis.aspx

Bundling and Minification in ASP.NET MVC 4

http://www.dotnetexpertguide.com/2011/12/bundling-and-minification-aspnet-mvc4.html

Self-Host a Web API (C#)

http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.