WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

Case insensitive dynamic properties in $select

Open mikenorgate opened this issue 6 years ago • 1 comments

In version 7 the ability to have case insensitive URLs was added, this seems to work fine for predefined properties but when using an object with dynamic properties it doesn't

Assemblies affected

Microsoft.AspNetCore.OData 7.2.1

Reproduce steps

Create a type which has a dynamic properties dictionary which uses a case insensitive string comparer for the key Run a query with a $filter and a $select using a mixed case which doesn't match the keys in the dictionary

Expected result

The fields specified in the $select would be returned

Actual result

The fields specified in the $select are not returned

Additional detail

I think this comes down to this piece of code, where the Contains call on SelectedDynamicProperties is not case insensitive

https://github.com/OData/WebApi/blob/5061dcad757599b93ff990079832123a73e0e091/src/Microsoft.AspNet.OData.Shared/Formatter/Serialization/ODataResourceSerializer.cs#L553-L557

mikenorgate avatar Oct 11 '19 10:10 mikenorgate

I have the same problem. @xuzhg, is this problem fixed? If not, is there any workaround?

sharonllh avatar Apr 11 '23 08:04 sharonllh