我抓我的头有点如何模型粘合剂做他们在ASP.Net MVC的工作。
I'm scratching my head a bit at how model binders do their work in ASP.Net MVC.
要具体而言,BindModel()方法保存的型号名称和类型ModelBindingContext参数,但我不明白的ModelBindingContext如何接收这些值。
To be specific, the BindModel() method has a ModelBindingContext parameter that holds the model name and type, but I don't understand how the ModelBindingContext receives these values.
这是MVC模式必须从提交的表单值或查询字符串参数或其他数据源填充。但是,什么机制决定交给ModelBindingContext模型类型,以及如何选择是对另一机型一个模型类,甚至多(说)含个体的简单榜值?
An MVC model has to be populated from posted form values or query string parameters, or other sources of data. But what mechanism determines the model type handed to the ModelBindingContext, and how is one model type chosen over another model type, over even (say) a simple list containing the individual posted values?
它只是似乎我ModelBindingContext知道模型的类型它被递给了,我不知道在哪里了的来自或涉及填充它的工作流程。
It just appears to me the ModelBindingContext "knows" the type of model it's being handed, and I'm not sure where that's coming from or the workflow involved in populating it.
推荐答案有趣的问题。这里是什么MVC做了一个简单的概述。这一切都被ControllerActionInovker类处理。这不是在特定的顺序,但靠近
Interesting question. Here is a simple overview of what MVC does. It's all handled by the ControllerActionInovker class. This is not in specific order, but is close.
您可以在位于codeplex 。查找ControllerActionInvoker类和GetParameterValue方法。
You can see this for yourself in the ASP MVC source located at codeplex. Look for the ControllerActionInvoker class and the GetParameterValue method.
更多推荐
ASP.Net MVC ModelBindingContext分类
发布评论