oData expand

3 posts, 0 answers
  1. Mike
    Mike avatar
    75 posts
    Member since:
    Nov 2011

    Posted 19 Oct 2015 Link to this post

    Hello, 

    I'm using Telerik Data Access in a Web API project that support oData queries. My need is to be able to filter the result of the ​$expand operation. The problem is that the $expand does not call the controller of the target entity. For example:

    Parent and Child, I have a controller for each entity. I have also a filter on the getAllChilds in the Child controller (for example, return only childs from 25 to 26 years old). But when the user call getAllParents and then expand one parent's childs, the child controller is not called. Is it possible to override the oData expand? or maybe force the expand to call the target entity controller? 

    Thanks for your help

    Regards

  2. Mike
    Mike avatar
    75 posts
    Member since:
    Nov 2011

    Posted 20 Oct 2015 in reply to Mike Link to this post

    No replies :(
  3. DevCraft banner
  4. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 22 Oct 2015 Link to this post

    Hello Rapidone,

    Thank you for contacting us.

    The behavior you are experiencing is intended as per the design of the WEB API framework. The $expand option does not specify another endpoint which should be called bur rather just modifies the behavior of the targeted endpoint. For this reason it is normal that the getAllChilds endpoint is not called and the getAllParents endpoint is likely called instead.

    With this in mind, in order to use a filter for the related Child objects we would recommend trying to modify the behavior of the getAllParents endpoint to apply the desired filter when it receives the $expand option if this is a viable approach in the architecture of your project.

    I hope this helps. If you have further questions feel free to get back to us.

    Regards,
    Kristian Nikolov
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top