MVC Framework 奇怪的設計 - ViewEngineResult

  • 1494
  • 0

MVC Framework 奇怪的設計 - ViewEngineResult

剛在詳細鑽研 IViewEngine 的使用方法,這Interface 最主要的是在View的部分,把Request 轉成ViewEngineResult的物件。
然後看了MSDN ViewEngineResult,描述如下

 

Name Description
ViewEngineResult(IEnumerable<String>) Initializes a new instance of the ViewEngineResult class by using the specified searched locations.
ViewEngineResult(IView, IViewEngine) Initializes a new instance of the ViewEngineResult class by using the specified view and view engine.

這設計好奇怪,怎麼會因為結果需求不同而使用不同的Constructor。這MVC 3 就知道是不好的設計,沒想到MVC4還是沒被修正。