The $expand option in the query filter is used to request entities associated with the last segment of a request. This is often used to ensure that entities can be materialized with their relationships wired together and to reduce the number of roundtrips to the server.
For example, if http://www.example.com/service.svc/Customers returns all customers, then http://www.example.com/service.svc/Customers?$expand=Orders could be used to return all customers with all their Orders, assuming customers have an Orders collection.
http://www.example.com/service.svc/Customers
http://www.example.com/service.svc/Customers?$expand=Orders
You can use request multiple references and collections to be exapnded. One gotcha about the $expand syntax is that there is a different syntax for "drilling" through references: the forward slash is used to indicate drilling in, while a comma is used to separate the parallel expansion paths.
Here are some examples that will hopefully clarify this (omitting the path to the service).
/Customers?$expand=Orders
/Customers?$expand=Orders,Preferences
/Customers?$expand=Orders,Orders/OrderDetails,Preferences
/Customers?$expand=Orders/OrderDetails,Preferences
/Customers?$expand=Orders/OrderDetails,Orders/ShippingInfo
Hope this was helpful - please post comments if you have further questions!
PingBack from http://mgalinks.wordpress.com/2008/12/02/2008-december-02-links-for-today/