I changed the relation and instead of having Parent and Child I use only one table:
public class Info
{
public DateTime Timestamp;
public string Name;
}
In order to get all records between dates, sorted and get them from index startRow to startRow + count I used the following:
public IList<Info> GetInfo (DateTime fromDate, DateTime toDate, int startRow, int count)
{
IList<Info> result =
QueryOver<Info>()
.Where(row => row.Timestamp >= fromDate)
.And(row => row.Timestamp <= toDate)
.OrderBy(row => row.Timestamp).Asc
.Skip(startRow).Take(count).List();
return result;
}
The resulted SQL is:
SELECT * FROM Info WHERE timestamp >= :fromDate AND timestamp <= :toDate
ORDER BY timestamp ASC OFFSET :startRow ROWS FETCH NEXT :count ROWS ONLY