ModelBindingContext MODELNAME [英] ModelBindingContext ModelName

查看:239
本文介绍了ModelBindingContext MODELNAME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释其中MODELNAME会从人口?

Can anyone explain where the ModelName gets populated from?

看着MSDN文档这里没有交代英寸
我创建一个自定义的模型绑定,并在其中我得到空为以下几点:
    VAR的结果= bindingContext.ModelName);

Looked in MSDN documentation and no explaination here. I am creating a custom model binder and within it I get null for the following: var result = bindingContext.ModelName);

推荐答案

该ModelBindingContext对象被创建并通过调用谁进入BindModel()方法填充。如果模型进来作为参数传递给您的操作方法,这是由ControllerActionInvoker.GetParameterValue()来完成,而MODELNAME属性将被设置为参数的名称(除非[装订(preFIX =覆盖。 ..)])。

The ModelBindingContext object is created and populated by whoever calls into the BindModel() method. If the model is coming in as an argument to your action method, this is done by ControllerActionInvoker.GetParameterValue(), and the ModelName property will be set to the name of the parameter (unless overridden by [Bind(Prefix = ... )]).

如果模型正在通过的UpdateModel(更新),则ModelBindingContext对象由的UpdateModel()方法本身产生的。该MODELNAME参数将是 preFIX 的参数传递给的UpdateModel()。

If the model is being updated via UpdateModel(), the ModelBindingContext object is created by the UpdateModel() method itself. The ModelName parameter will be the prefix argument passed to UpdateModel().

这篇关于ModelBindingContext MODELNAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆