This is a migrated thread and some comments may be shown as answers.

oData expand

2 Answers 64 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 19 Oct 2015, 01:58 PM

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 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 20 Oct 2015, 02:42 PM
No replies :(
0
Kristian Nikolov
Telerik team
answered on 22 Oct 2015, 07:47 AM
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.
Tags
Development (API, general questions)
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Kristian Nikolov
Telerik team
Share this question
or