Tuesday, January 22, 2013

OData: include multiple children in a result set

Last week I got the following question:

“I have an OData service that returns a set of Portfolios. Each portfolio also has a list of Sectors, a list of Technologies and a list of Customers. How can I query this OData feed and get all the results back in one request?”

To achieve this we need to use the Expand() keyword

Here is a sample how to do this in Linq;

And here is the resulting url that returns the same results: