Get item index (rownum)
问题 I have table with 10 000 elements. IQuerable<IEntity> query = dataRep.Get<IEntity>() .Query(); I need to get the index(rownum) of selected obj without getting all table items var obj = query.Where( x => x.Name == "testName") .FirstOrDefault(); The simple sql work fine : select name, id, r from ( select name, id, rownum r from collections order by id ) where name = 'testName'; How do this in Linq to NHibernate ? Edit: I tried add to IEntity class property RowNumber and mapping this on hbm as