We have a project based on the DynamicEdmModelCreation project from ODataSamples-master odata examples.
We have set a Routing Convention that handle all request to this specific controller:
[HttpGet]
[EnableQuery]
public EdmEntityObjectCollection Get()
{
...
}
[EnableQuery]
public IEdmEntityObject Get(string key)
{
...
}
We try for example
/odata/Hotels -> OK!
/odata/Hotels(1) -> Ok!
/odata/Hotels(1)/Room -> Response:
No routing convention was found to select an action for the OData path with template '~/entityset/key/navigation'.
Debuging we see that the route convention handle well the request and redirect it to our controller but no method is executed. The Routing Convention is:
public class MatchRoutingConventionService : IODataRoutingConvention
{
public string SelectAction(
ODataPath odataPath,
HttpControllerContext controllerContext,
ILookup<string, HttpActionDescriptor> actionMap)
{
return null;
}
public string SelectController(ODataPath odataPath, HttpRequestMessage request)
{
return (odataPath.Segments.FirstOrDefault() is EntitySetPathSegment) ? "HamdleAll" : null;
}
}
We think the problem may be in WebApi chossing the correct method that will handle the request because since we are using the generic signature IEdmEntityObject Get(string key).