共用方式為


DefaultModelBinder.CreateModel 方法

定義

使用指定的控制器內容和繫結內容,建立指定的模型型別。

protected virtual object CreateModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, Type modelType);
abstract member CreateModel : System.Web.Mvc.ControllerContext * System.Web.Mvc.ModelBindingContext * Type -> obj
override this.CreateModel : System.Web.Mvc.ControllerContext * System.Web.Mvc.ModelBindingContext * Type -> obj
Protected Overridable Function CreateModel (controllerContext As ControllerContext, bindingContext As ModelBindingContext, modelType As Type) As Object

參數

controllerContext
ControllerContext

控制器在其中運作的內容。 此內容資訊包含控制器、HTTP 內容、要求內容和路由資料。

bindingContext
ModelBindingContext

模型在其中繫結的內容。 此內容包含如模型物件、模型名稱、模型型別、屬性篩選和值提供者這類資訊。

modelType
Type

要傳回之模型物件的型別。

傳回

指定之型別的資料物件。

適用於