Asp.net mvc 2 ASP.NET MVC2-解析模型绑定器中的参数属性

Asp.net mvc 2 ASP.NET MVC2-解析模型绑定器中的参数属性,asp.net-mvc-2,attributes,custom-model-binder,filterattribute,Asp.net Mvc 2,Attributes,Custom Model Binder,Filterattribute,给出如下动作: public ActionResult DoStuff([CustomAttribute("foo")]string value) { // ... } 是否有任何方法可以解析ModelBinder中的value的CustomAttribute实例?我在查看MVC源代码,很可能我只是做错了,但是当我尝试复制它们的代码来检索复杂模型的BindAttribute时,调用GetAttributes()并没有返回我要查找的属性 DefaultModelBinder GetTypeD

给出如下动作:

public ActionResult DoStuff([CustomAttribute("foo")]string value) {
  // ...
}
是否有任何方法可以解析ModelBinder中的
value
CustomAttribute
实例?我在查看MVC源代码,很可能我只是做错了,但是当我尝试复制它们的代码来检索复杂模型的BindAttribute时,调用GetAttributes()并没有返回我要查找的属性

DefaultModelBinder

GetTypeDescriptor(controllerContext, bindingContext).GetAttributes();
我在Twitter上与他交谈过,他表示,这可以通过在所需类型上实现新的IMetadataAware接口,通过AspNet4 Futures程序集中的ModelMetadataProvider实现。此外,他还表示,MVC3将为.NET3.5和.NET4.0引入此功能