I\'m trying to determine how to count the matching rows on a table using the EntityFramework.
The problem is that each row might have many
This is my code:
IQueryable records = db.AuctionRecord;
var count = records.Count();
Make sure the variable is defined as IQueryable then when you use Count() method, EF will execute something like
select count(*) from ...
Otherwise, if the records is defined as IEnumerable, the sql generated will query the entire table and count rows returned.