WebApi
WebApi copied to clipboard
ODataPathSegmentHandler is not aware of key-as-segment
Hi I am using Microsoft.AspNetCore.OData 7.0.1
I am trying to use key-as-segment (users/1
instead of users(1)
)
I set SetUrlKeyDelimiter(ODataUrlKeyDelimiter.Slash)
, also set up ODataSimplifiedOptions
and enable EnableReadingKeyAsSegment
and EnableWritingKeyAsSegment
.
Most of the thing works fine (parsing, simplified namespaces), except one thing.
EditLink generated in mixed-style, both parentheses-style and key-as-segment in one url
"@editLink": "users(30)/profiles/test"
Without key-as-segment and namespace simplifications response is
"@odata.editLink": "users(30)/profiles('test')"
I made some research and found, that problem in ODataPathSegmentHandler.Handle(KeySegment)
It unconditionally uses parentheses-style for handling KeySegment.
I think ODataPathSegmentHandler shoul be refactored to support key-as-segment.
Hi again, recently I updated my project to Microsoft.AspNetCore.OData, Version 8.0.8, and this bug is still present in 2022.
i have created a sample project in OData v8 and facing the same issue
bug: https://github.com/OData/AspNetCoreOData/issues/606
Repository: https://github.com/padhumailin/ODataRouteComponent