title: How to apply ODataQueryOptions for DTO to underlying EntitySet?
body: <p>There are 2 classes, Foo and Bar. There is a Bar object nested in a Foo object.</p>
  
  <pre><code>public class Foo {
      public Guid FooId { get; set; }
      public string FooName { get; set; }
      [ForeignKey("Bar")]
      public Guid BarId { get; set; }
  
      public virtual Bar Bar { get; set; }
  }
  
  public class Bar {
      public Guid BarId { get; set; }
      public string BarName { get; set; }
  }
  
  public class FooBarContext : DbContext {
      public DbSet&lt;Foo&gt; Foos { get; set; }
      public DbSet&lt;Bar&gt; Bars { get; set; }
  }
  
  public class FooDTO {
      public Guid FooId { get; set; }
      public string FooName { get; set; }
      public Guid BarId { get; set; }
      public string BarName { get; set; }
  }
  </code></pre>
  
  <p>My question is: can I somehow translate the OData query for FooDTO to OData query for Foo, such that it can be applied to the Foos DbSet?</p>
  
  <p>For example, I'd like to query by BarName, which is ultimately from the nested Bar object.</p>
  
  <pre><code>GET /Foos?$filter=BarName eq 'Bar2'
  </code></pre>
  
  <p>And here is the controller and action to process the query</p>
  
  <pre><code>public class FoosController {
      public async Task&lt;IHttpActionResult&gt; GetFoos(ODataQueryOptions&lt;FooDTO&gt; queryOptions) {
          // translate filter FooDTO.BarName to filter Foo.Bar.Name
          // ODataQueryOptions&lt;Foo&gt; fooQueryOptions = ....
          using (var context = new FooBarContext()) {
              return fooQueryOptions.ApplyTo(context.Foos);
          }
      }
  }
  </code></pre>
  
  <p>Thank you.</p>