2012-09-04 22 views
1

我正在閱讀以下「WebAPI是一個偉大的建設HTTP服務」,所以我想更多地瞭解這個現在我正在改變到MVC4。WebAPI vs MVC 4控制器爲jquery調用我的方法,返回json

我的web應用程序使用jQuery來調用我的控制器上返回json結果的方法。這是否意味着將來使用WebAPI控制器會更好?

對傳統控制器進行的調用與對WebAPI控制器的調用之間的高速緩存是否有區別?

回答

3

My web application uses jQuery to make calls to methods on my controller that return json results. Does this mean it would be better for me in future to use the WebAPI controllers?

不一定,你可以返回JSON出與MVC爲好。 Web.API爲您提供許多開箱即用的特性,您必須使用MVC自行實現它。

Is there any difference in caching between a call made to a traditional controller and a call made to a WebAPI controller?

緩存是一個很寬泛的概念。你可以使用OutputCaching和MVC,你也可以採用輸出緩存到web.api。看看here

不過,也有除了OutputCaching各種緩存技術,比如擁有自己的高速緩存和管理您的緩存容器等

對於我來說,web.api可用於單頁的應用程序,數據層或服務層。

相關問題