1
votes

How do I retrieve the @odata.context value from a request to a aspnetcore 2.1 using odata v4 (microsoft aspnetcore.odata 7.0.1) inside the controller?

I needed to form my response as { "@odata.context":"https://localhost:5001/odata/$metadata#Products/$entity", "value" :[{ "id":"b79a6aa2-ed65-400c-8f7d-42052412b0b4"}] }

rather than ``{"@odata.context":"https://localhost:5001/odata/$metadata#Products/$entity","id":"b79a6aa2-ed65-400c-8f7d-42052412b0b4"}

Thank you!! Alberto

1
On the other hand I found out I don't need to change the return type as it was a bug in the syncfusion library (now fixed with the latest version ). - Alberto L. Bonfiglio

1 Answers

0
votes

It looks like your controller is returning a single value response, if you have it return an Enumerable then it'll be in the form you want