Would it make sense for the RestfulRouteConventionAttribute to check if an action method has the ActionNameAttribute applied to it? I have a scenario where I have multiple submit buttons on a single form for different types of updates. I am using another ActionMethodSelectorAttribute that checks the submit button pressed to pick the appropriate action method. I haven't tested this but was thinking the GetRouteAttributes method could look something like this:
public override IEnumerable<AttributeRouting.IRouteAttribute> GetRouteAttributes(System.Reflection.MethodInfo actionMethod) {
// Check if method has an ActionNameAttribute applied to it
var actionNameAttribute = (ActionNameAttribute) actionMethod.GetCustomAttributes(typeof(ActionNameAttribute), true).FirstOrDefault();
var methodActionName = (actionNameAttribute == null) ? actionMethod.Name : actionNameAttribute.Name;
var convention = Conventions.SingleOrDefault(c => c.ActionName == methodActionName);
if (convention != null)
yield return BuildRouteAttribute(convention);
}
Would it make sense for the RestfulRouteConventionAttribute to check if an action method has the ActionNameAttribute applied to it? I have a scenario where I have multiple submit buttons on a single form for different types of updates. I am using another ActionMethodSelectorAttribute that checks the submit button pressed to pick the appropriate action method. I haven't tested this but was thinking the GetRouteAttributes method could look something like this: