Q:

Counting in Entity Framework

Is there a way to keep efficient counting on Entity Framework?  Please, any help would be appreciated. 
I am trying to count rows on an EF query, but the count goes in timeout, nevertheless the query itself it is ok. 
Tried with .AsNoTracking() also. 
Example:
ObjGetIndexedViewResult. TotRecord = listDocuments. AsNoTracking()
                                                 .Select(x => new { x.id })
                                                 .Count();

A:

sorry for bothering ya, just found the solution! 
with .Distinct(). 
   ObjGetIndexedViewResult. TotRecord = listDocuments. Distinct().AsNoTracking().Select(x => new { x.id }).Count();

