title: Is Linq to WCF OData good for complex queries
body: <p>Currently we are evaluating whether we should use WCF data services as DAL for our application and I am doing a POC to see if WCF data service craters to all our scenarios. If I am having a data model as below</p>
  
  <p><img src="https://i.stack.imgur.com/FIVD0.png" alt="DataModel"></p>
  
  <p>and I want to Get All products > $100 ordered by a person with Id 1 how would I do it using Linq to OData as there are many restrictions on Linq operators when using with OData.</p>
  
  <pre><code>dbContext.LineItems.Where(li =&gt; li.Order.PersonId == 1 &amp;&amp; li.Product.Cost &gt; 
  120).Select( li =&gt; new { Product = li.Product})
  </code></pre>
  
  <p>The above code generates very obscure T-SQL on Sql server, ideally I would want to drill down from top to bottom (from Order to Products if wring LINQ Query or direct T-SQL) joining tables but using OData it always seems to be going from bottom to top which I don't feel very comfortable and in some cases generates very bad sql when we have to query more then two table in a singe query. </p>
  
  <p>In our application we are expecting scenarios like this where we have to query(write conditions) up to 4 tables in a singe query and select a single entity. For these kind of complex queries is OData correct at all?</p>
  
  <p>Thanks for reading a long post.</p>