背景:
在MVC3中,我使用以下语法指定自定义Action参数名称:
public ActionResult ActionName([Bind(Prefix = "principalID")] int userID,
[Bind(Prefix = "dependentID")] long applicationID)
Run Code Online (Sandbox Code Playgroud)
此操作的路由定义如下(ActionNameConstraint是自定义IRouteConstraint):
routes.MapHttpRoute(
"DependantAction",
"{controller}/{principalID}/{action}/{dependentID}",
new {controller = @"[^0-9]+", action = ActionNameConstraint.Instance, dependentID = RouteParameter.Optional}
);
Run Code Online (Sandbox Code Playgroud)
题:
这BindAttribute是一System.Web.Mvc堂课.Web Api中是否存在相当于此(参数绑定)的内容?
当然,如果有其他解决方案可以达到相同的效果,我很乐意听到它们!