ASP.NET MVC2 - allow parameter attribute in model binding

Given an action like:

public ActionResult DoStuff([CustomAttribute("foo")]string value) {
  // ...
}

Is there a way to allow an instance value CustomAttributein ModelBinder? I looked at MVC sources and most likely I am just doing it wrong, but when I tried to reproduce their code that retrieves BindAttribute for a complex model, calling GetAttributes () does not return the attribute I'm looking for.

DefaultModelBinder

GetTypeDescriptor(controllerContext, bindingContext).GetAttributes();
+3
source share
1 answer

Twitter, , ModelMetadataProvider AspNet4 Futures IMetadataAware , , , ​​ MVC 3 .NET 3.5 .NET 4.0.

0

Source: https://habr.com/ru/post/1734603/


All Articles