Is there a way to get the row count of a complex Linq query and millions of records without hitting the db twice or writing 2 separate queries??
it is so easy on sql server . you can write this query :
select count() over(), table.* from table
the count () over() will return the count of total row in result , So you don't need to run two query.. Remember that you should run raw sql on your context or use dapper that return result as view model