Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
ADO.NET Data Services System Query Options

URI system query options represent directives that ADO.NET Data Services use to control the response to a request. The following tables summarize the options supported by ADO.NET Data Services.

Summary of Supported System Query Options

The following tables list and describe the query options used by ADO.NET Data Services URIs. These options can be appended to queries in order to limit or sort the results.

Option Description

$expand

Used to request that sets referenced by the target set are returned inline instead of as deferred content.

$filter

Returns only the elements from the target set that satisfy the specified predicate.

$orderby

Sorts the target entity set in ascending or descending order.

$skip

Seeks n items into the target, then returns items n+1 to the end of the set.

$top

Returns the top n items from the target set.

If a query option is included with a URI to a resource that does not support the operation, a 400 Bad Request response code is returned.

Order of Query Option Application

When an ADO.NET Data Service applies the query order, it does so in the order specified by the following list. If any of the options is missing, the corresponding step is skipped.

$filter. This restricts the set of returned elements.

$orderby. This sets the order of the returned elements.

$skip. This skips a number of elements

$top. This restricts the number of elements returned.

$expand. This returns related content with base elements returned.

The URI http://www.example.com/service.svc/Orders?$orderby=ID&$top=10&$skip=10 indicates that the Orders returned will be #11 through #21 from the list of orders sorted by their ID property values.

System Query Options supported per URI

The following tables enumerate the query options that are supported or not supported by each type of URI syntax. Each syntax example is followed by a table that lists the supported options for that syntax.

URI: serviceName/<EntitySet>
Option Supported Notes

$expand

Yes

Returns an entity set.

$filter

Yes

Returns an entity set.

$orderby

Yes

Returns an entity set.

$skip

Yes

Returns an entity set.

$top

Yes

Returns an entity set.

URI: serviceName/<ResourceSet>(KeyPredicate)
Option Supported Notes

$expand

Yes

Returns resources identified by the conditions specified, usually data in relationship to the base resource set.

$filter

Yes

Returns the resources if the filter condition is true; a 404 Resource Not Found response will be returned otherwise.

$orderby

No

$skip

No

$top

No

URI: serviceName/<ResourceSet>(KeyPredicate)/<ResourceComplexType>
Option Supported Notes

$expand

Yes

Complex types are always expanded even if $expand is not present in the URI.

$filter

Yes

Returns a complex type instance if the filter condition is true; a 404 Resource Not Found response will be returned otherwise.

$orderby

No

$skip

No

$top

No

URI: serviceName/<ResourceSet>(KeyPredicate)/<ResourceComplexType>/<ResourceProperty>
Option Supported Notes

$expand

Yes

Complex types are always expanded even if $expand is not present in the URI. The resource property has no properties of its own that can be expanded if it is not a complex type.

$filter

No

$orderby

No

$skip

No

$top

No

URI: serviceName/<ResourceSet>(KeyPredicate)/<ResourceProperty>
Option Supported Notes

$expand

Yes

Complex types are always expanded even if $expand is not present in the URI. The resource property has no properties of its own that can be expanded if it is not a complex type.

$filter

No

$orderby

No

$skip

No

$top

No

URI: serviceName/<Resource Set>(KeyPredicate)/<ResourceNavigationProperty>

If the navigation property in the previous example represents a one-to-one or many-to-one relationship, the query options are described by the following table:

Option Supported Notes

$expand

Yes

Returns an entity type instance.

$filter

Yes

Returns an entity type instance.

$orderby

No

$skip

No

$top

No

If the navigation property represents a one-to-many or many-to-many relationship, the query options are described by the following table:

Option Supported Notes

$expand

Yes

Returns an entity set

$filter

Yes

Returns an entity set

$orderby

Yes

Returns an entity set

$skip

Yes

Returns an entity set

$top

Yes

Returns an entity set

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker