title: LINQ to SQL Select Distinct by Multiple Columns and return entire entity
body: <p>I am working with a third party database and need to select a distinct set of data for the specific market that I am looking into. The data is the same for each market, so it is redundant to pull it all in, and I don't want to hardcode any logic around it as we are working with the vendor to fix the issue, but we need a fix that will work with the vendors fix as well as the way the database is currently as it could be some time before thier fix goes live.</p>
  
  <p>I do not want to group by anything as I want to get the data at the lowest level, but I don't want any redundant data. My current query looks similar to this...</p>
  
  <pre><code>determinantData = (from x in dbContext.Datas
                     where x.Bar.Name.Equals(barName) &amp;&amp;
                           x.Something.Name.Equals(someName) &amp;&amp;
                           FooIds.Contains(x.Foo.Id) &amp;&amp;
                           x.Date &gt;= startDate &amp;&amp; 
                           x.Date &lt;= endDate
                     select x).Distinct();
  </code></pre>
  
  <p>This does not do what I expect. I would like to select the distinct records by three properties, say <code>Foo</code>, <code>Bar</code>, and <code>Something</code> but return the entire object. How can I do this using LINQ?</p>