5

I have a component with ODataAdaptor as a data source, now i would like to make a Patch request with $expand query like i make for GET request(since GET request openly supports $expand query). But i don't have an idea whether it is accepted or is there any other way i can look into to approach this issue?

Actual request: http://localhost:49807/odata/Orders(10249)

Expected request: http://localhost:49807/odata/Orders(10249)/?$expand=OrderDetail($select=CustomerID)

with $expand query in Patch request.

Logesh
  • 51
  • 2

1 Answers1

2

You can't easily Patch to nested properties, this is well documented restriction. However if you want to patch a single object, and return a result with the expanded path you have suggested then there are two simple steps to achieve this:

  1. Add the [EnableQuery] attribute to your Patch endpoint method.
  2. Make sure your patch response returns an IQueryable result, or that you aggressively include / eager load all the potential expansions to your object response inside the method body, then the serializer will return the expanded object graph.
Chris Schaller
  • 13,704
  • 3
  • 43
  • 81