TryUpdateModel的excludeProperties参数有哪些集合参考?

时间:2011-05-19 18:19:29

标签: c# asp.net-mvc-3 model

http://msdn.microsoft.com/en-us/library/dd492957.aspx中的excludeProperties参数是否排除了模型中的属性或请求中的值?

E.g。

如果我希望排除名称属性为“Model.SomeProperty.SomeChildProperty”的Model.SomeProperty.SomeChildProperty,我是否应该通过
["SomeProperty"](模型上属性的名称)

["Model.SomeProperty.SomeChildProperty"](请求表单中字段的名称)

将其从udpate中排除?

1 个答案:

答案 0 :(得分:2)

在模型绑定期间过滤属性时,DefaultModelBinder会查看PropertyDescriptor.Name。您应该使用模型属性名称。

相关问题