Are there any way to get index of ordered queryable without getting all items?
My code seems to be killer of network traffic:
public virtual async Task<int> GetIndexOfQueryable<TOrderKey>(Expression<Func<TEntity, bool>> whereExp, Predicate<TEntity> findIndexExp, Expression<Func<TEntity, TOrderKey>> orderbyExp, bool descending)
{
IQueryable<TEntity> query = whereExp != null ? DbSet.Where(whereExp) : DbSet.AsQueryable();
if (orderbyExp != null)
query = !descending ? query.OrderBy(orderbyExp) : query.OrderByDescending(orderbyExp);
return (await query.ToListAsync()).FindIndex(findIndexExp);
}