0
votes

I have been looking for solution to parse OData URL to replace the column names used.

The purpose is to accept OData query on server to particular entity type, forward the query to another OData-service with similar structure but other column names and return the result as the previous type.
In other words provide a general interface for OData client but be able to fetch the data to other sources but retain the sorting and filtering asked for by the client.

Simple solution would be to text-replace the desired column names but this could conflict with possible string values in the query. Using RegEx for this is highly complicated so proper parser is probably needed.

The best solution would be to parse through the ODataQueryOptions.Filter and OrderBy, replacing column names and return new OData query-string.

So the question is.. Does anyone know of library or code snippets that support parsing the ODataQueryOptions structure back to OData URI ?

Note: this solution must work with OData version 3 since I am restricted to that version in my project.

1

1 Answers

0
votes

Ok, I just went a head and wrote the parser myself. I published the code on Github