title: Web API 2.2 - OData v4 (Manually Parsing Uri + Expanding)
body: <p>I have an ODataController with a Get method as such:</p>
  
  <pre><code>public IHttpActionResult Get(ODataQueryOptions&lt;MyModel&gt; queryOptions) {
    IQueryable&lt;MyModel&gt; models = _Models.AsQueryable(); // _Models Defined in Controller as List&lt;MyModel&gt; and is already populated with nested data for both .LevelOne and .LevelOne.LevelTwo which are two other Lists.
  
    Uri fullrequest = Request.GetRequestContext().Url.Request.RequestUri; // http://localhost:8080/odata/Root?$expand=LevelOne($expand=LevelTwo)
    Uri serviceroot = new Uri(controller.GetLeftPart(UriPartial.Path).Replace("/Root", "")); // http://localhost:8080/odata
    String metadata = service + "/$metadata"; // http://localhost:8080/odata/$metadata
  
    IEdmModel model = EdmxReader.Parse(XmlTextReader.Create(metadata));
    ODataUriParser parser = new ODataUriParser(model, serviceroot, fullrequest);
    SelectExpandClause selectAndExpand = parser.ParseSelectAndExpand();
  
  //Only one of the two below lines is ever commented in...
    Request.ODataProperties().SelectExpandClause = queryOptions.SelectExpand.SelectExpandClause; // This line will work
    Request.ODataProperties().SelectExpandClause = selectAndExpand; // This line will not work
  
    return Ok(models);
  }
  </code></pre>
  
  <p>using my manually parsed selectAndExpand does not expand the dataset, but using the predefined queryOptions one does. Any ideas why? Both objects appear to contain the same information while viewed in the debugger, but I must be missing something. I want to be able to parse the URI myself, without the need for the ODataQueryOptions at all. </p>