In EF, when having to deal with indexes, we need to convert the entity collection to a list as IQueryable
or IEnumerable
do not implement any indexer (it would be meaningless due to the deferred execution mechanism). When having a pretty large collection using ToList
for using indexes would be heavy.
This is why I sometimes need to look up entities by the row number (not the identity / primary key). For example, I have one record, I want to get its row number (position in the sorted table) and get the next record.
Can this be achieved in Entity Framework? I can send SQL queries to do this, but I'm curious if there is a Linqish and EF specific approach to do this.