ODataQueryOptions should allow duplicate non-OData query options
Our Web API exposes both OData and custom query options. Some of our query options allow duplicate values, but the ODataQueryOptions constructor throws an exception when it detects any duplicate query options (not just standard OData query options). This requires us to maintain a lot of code to work around this issue that we would rather not have to maintain.
WebAPI should have no opinions on whether it is valid to have duplicate custom query options. A Dictionary should only be used to hold OData query options, not custom query options. See this line in the ODataQueryOptions constructor:
IDictionary<string, string> queryParameters =
request.GetQueryNameValuePairs().ToDictionary(p => p.Key, p => p.Value);
Pre-process the name value pairs, before creating the dictionary.
relay on ODL https://github.com/OData/odata.net/issues/375
Related issue: https://github.com/OData/odata.net/issues/245.
Merged for 6.x, need merge in 5.x when OData 5.x include this fix. a10881f462d24bca53a5373d9d3e64a3df9f7e2b
@VikingsFan Hey - I just ran into this problem today. We're on .NET 4.6.1 and so I can't upgrade to OData 6.0.0 (due to the dependency injection framework). Is there any chance that this will be backported to the 5.9.x branch?
Thanks!
@xuzhg This issue appears to have been fixed, at least in 7.x. Can this issue be closed?
Closing this issue. If this still affects the latest versions of the library, kindly open a new issue.