title: Lambda expression to count distinct rows in a table
body: <p>I'm trying to switch from Linq to lambda expression. I want the count of distinct rows in my table.</p>
  
  <p>Is there a better way to get it that the one below?</p>
  
  <pre><code> var count = _db.myTable
       .Where(i=&gt;i.DATE.HasValue &amp;&amp; i.DATE==DateFrom)
       .AsEnumerable()
       .Select(x=&gt;x.myTable_ID)
       .Distinct()
       .Count();
  </code></pre>