Skip to content

Instantly share code, notes, and snippets.

@ODataTeam
Last active August 29, 2015 14:03
Show Gist options
  • Save ODataTeam/492c2cc87a01ee5a617b to your computer and use it in GitHub Desktop.
Save ODataTeam/492c2cc87a01ee5a617b to your computer and use it in GitHub Desktop.
Parsing query options
Uri fullUri = new Uri("Products?$select=ID&$expand=ProductDetail" +
"&$filter=Categories/any(d:d/ID%20gt%201)&$orderby=ID%20desc" +
"&$top=1&$count=true&$search=tom", UriKind.Relative);
ODataUriParser parser = new ODataUriParser(model, serviceRoot, fullUri);
SelectExpandClause expand =
parser.ParseSelectAndExpand(); //parse $select, $expand
FilterClause filter = parser.ParseFilter(); // parse $filter
OrderByClause orderby = parser.ParseOrderBy(); // parse $orderby
SearchClause search = parser.ParseSearch(); // parse $search
long? top = parser.ParseTop(); // parse $top
long? skip = parser.ParseSkip(); // parse $skip
bool? count = parser.ParseCount(); // parse $count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment