Currently we have a page where we need pagination so for that i need 2 info
1. Get total number of rows
2. Fetch 'N' number of rows
Currently i am doing it with 2 query, for step 1 something like
count = db.Transactions
.AsNoTracking()
.Where(whereClause
.Count();
And then
db.Transactions
.AsNoTracking()
.Where(whereClause
.Skip(skipRows)
.Take(pagesize)
.ToList();
Is there is any way to optimize it?