Open onthepenciltip opened 1 month ago
By default, when you use new { x.Title, x.Id }
, C# automatically assigns the property names based on the original names of the properties in your class, which are Title and Id. This is why you're seeing Title and Id in the output instead of the custom title and id specified by the [ODataPropertyName] attributes.
To resolve this, you'll need to explicitly rename the properties in your anonymous type to match the names you want in the output. You can do this by using this syntax:
.Select(x => new { title = x.Title, id = x.Id })
While it is possible to modify the library to automatically map the [ODataPropertyName] attribute to the names, I don’t think that would be the right call.
Having some class,
the next code doesn't work as expected:
We get value
Title,Id
for$select
but expectingtitle,id
.