title: Get total row count in Entity Framework
body: <p>I'm using Entity Framework to get the total row count for a table. I simply want the row count, no where clause or anything like that. The following query works, but is slow. It took about 7 seconds to return the count of 4475. </p>
  
  <p>My guess here is that it's iterating through the entire table, just like how <a href="http://msdn.microsoft.com/en-us/library/system.linq.enumerable.count.aspx" rel="noreferrer">IEnumerable.Count()</a> extension method works.</p>
  
  <p>Is there a way I can get the total row count "quickly"? is there a better way?</p>
  
  <pre><code>    public int GetLogCount()
      {
          using (var context = new my_db_entities(connection_string))
          {
              return context.Logs.Count();
          }
      }
  </code></pre>