Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's right. You do not need a custom path handler for that. It represents a valid OData URL that we do understand and can parse it into an <code>ODataPath</code>. What you need would be a custom routing convention. A routing convention maps an ODataPath to a controller and an action. Be default, we ship only basic routing conventions that handle urls that WCF DS client generates. Looks like you are using an URL for which we do not have a routing convention. It is simple to write one though. Example,</p> <pre><code>public class ContainmentRoutingConvention : IODataRoutingConvention { public string SelectAction(ODataPath odataPath, HttpControllerContext controllerContext, ILookup&lt;string, HttpActionDescriptor&gt; actionMap) { IEdmEntitySet entitySet = odataPath.EntitySet; if (odataPath.PathTemplate == "~/entityset/key/navigation") { controllerContext.RouteData.Values["key"] = (odataPath.Segments[1] as KeyValuePathSegment).Value; return "Get" + entitySet.Name; } else if (odataPath.PathTemplate == "~/entityset/key/navigation/key") { controllerContext.RouteData.Values["key1"] = (odataPath.Segments[1] as KeyValuePathSegment).Value; controllerContext.RouteData.Values["key2"] = (odataPath.Segments[3] as KeyValuePathSegment).Value; return "Get" + entitySet.ElementType.Name; } return null; } public string SelectController(ODataPath odataPath, HttpRequestMessage request) { if (odataPath.PathTemplate == "~/entityset/key/navigation" || odataPath.PathTemplate == "~/entityset/key/navigation/key") { IEdmNavigationProperty navigationProperty = (odataPath.Segments[2] as NavigationPathSegment).NavigationProperty; IEdmEntitySet entitySet = odataPath.EntitySet; // the target entity set, which would be 'SubItems'; return entitySet.Name; } return null; } } </code></pre> <p>This would handle only the two urls that you mentioned. It should be easy to extend to support other url's too.</p> <p>The signature of the action that handles ~/entityset/key/navigation would be <code>IEnumerable&lt;Order&gt; GetOrders(int key)</code> and for the url ~/entityset/key/navigation/key, it would be <code>Order GetOrder(int key1, int key2)</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload