1

Closed

Action should support overload on derived bindable types

description

The scenario is that I want to support Wash action on all vehicle entities and I want to a different wash procedure for Car. Currently, it's not doable if I want to keep the same action name as wash.

If I define an action on Vehicle, and define two actions on VehiclesController: Wash() and WashOnCar(). It won't work. It will always fall back to Wash() because we use the action.EntityType to construct action name and it is always Vehicle.

If I define two actions in edm model, one on Vehicle and the other on Car, it will throw following exception:
{"Action resolution failed. Multiple actions matching the action identifier 'Wash' were found. The matching actions are: Default.Container.Wash, Default.Container.Wash.\r\nParameter name: actionIdentifier"}
at System.Web.Http.OData.Formatter.EdmLibHelpers.FindBindableAction(IEnumerable`1 functions, IEdmEntityType entityType, String actionIdentifier) in C:\dd\DevDiv\Offcycle\WPT\WebStackRuntime\runtime\src\System.Web.Http.OData\OData\Formatter\EdmLibHelpers.cs:line 301
Closed Nov 24, 2013 at 12:28 AM by jacalvar

comments

hongyes wrote Jan 17, 2013 at 9:24 PM

A workaround to this issue is to override ActionRoutingConvention to change the action name by looking for the entity type name in cast segment.

HongmeiG wrote Apr 1, 2013 at 7:14 PM

Please let me know if hongye's workaround works for you. We will revisit this feature in the future release.

raghuramn wrote Nov 19, 2013 at 8:21 PM