OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
685 stars 349 forks source link

How to request entity references? #2706

Open arfacoders opened 1 year ago

arfacoders commented 1 year ago

I'm currently working with the OData .Net Client and I'm trying to figure out how to request entity references using this client. Specifically, I want to retrieve the entity references for a specific entity by accessing the endpoint in the format "People({key})/Trips/$ref".

I have reviewed the OData client documentation and examples, but I couldn't find clear guidance on how to perform this type of request using the version I am currently using. I would greatly appreciate any assistance or guidance on how to achieve this.

Thank you for your assistance!

KenitoInc commented 1 year ago

What is the expected behaviour when you invoke People({key})/Trips/$ref ?

arfacoders commented 1 year ago

Having a controller action GetRefToTrips(int key) I would expect invoking container.People ByKey(key).Trips.ExecuteAsync() would invoke People({key})/Trips/$ref, or having a controller action GwtRefToAuthor and invoking container.Books.ByKey(key).Author.GetValueAsync() to invoke Books({key})/Author/$ref.