I\'ve a little question about performance with Entity Framework.
Something like
using (MyContext context = new MyContext())
{
Document DocObject
Calling ToList()
then Count()
will:
SELECT FROM WHERE
against your databaseList
object containing all the resultsCount
property of the .Net list you just createdCalling Count()
against an IQueryable
will:
SELECT COUNT FROM WHERE
against your databaseInt32
with the number of rowsObviously, if you're only interested in the number of items (not the items themselves), then you shouldn't ever call ToList()
first, as it will require a lot of resources for nothing.