Add a simple hook to re-write all outgoing OData links.


Right now, we generate a bunch of links in the OData response payloads. These are,

1) Self links - ID, edit and read links.
2) Navigation links,
3) Metadata links.

Customers want to use ODataConventionModelBuilder and yet have a simple way to rebase the links that get generated. Doing it right now involves fixing up these links for each and every entity set and navigation property which is lot of code. Also, the metadata link cannot be changed.

WCF DS supports this scenario. Refer to this blog post.
Closed Jan 15 at 8:00 AM by lianw
Closed here and moved the issue to GitHub (https://github.com/OData/WebApi/issues/42)


yishaigalatzer wrote Sep 9, 2013 at 9:24 PM

Need to figure out customer impact and amount of work required to move this to 5.1 or 6.0.

raghuramn wrote Sep 10, 2013 at 7:16 PM

A workaround is to replace the UrlHelper on the Request with a custom UrlHelper with overridden methods that rewrite the generated links. A sample is here.

raghuramn wrote Sep 10, 2013 at 7:19 PM

Unfortunately, the workaround above (custom UrlHelper) does not rewrite next page links as they don't go through the normal UrlHelper.Link generation code path. So, the sample above has added a custom feed serializer to rewrite the next page links before they are written to the response.